Commit graph

16097 commits

Author SHA1 Message Date
Alex Riesen c98a95eea8 ls-tree manpage: output of ls-tree is compatible with update-index
Such format relationships are very useful things to remember for
script writers.

Signed-off-by: Alex Riesen <raa.lkml@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-05-10 09:32:30 -07:00
Alex Riesen 713697b34f ls-tree manpage: use "unless" instead of "when ... is not"
Delayed negation in a statement is harder to spot and keep in mind.

Signed-off-by: Alex Riesen <raa.lkml@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-05-10 09:32:29 -07:00
Allan Caffee 2c5b011503 dir.c: Fix two minor grammatical errors in comments
Signed-off-by: Allan Caffee <allan.caffee@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-05-05 22:04:16 -07:00
Junio C Hamano 7dae8b21c2 diff -c -p: do not die on submodules
The combine diff logic knew only about blobs (and their checked-out form
in the work tree, either regular files or symlinks), and barfed when fed
submodules.  This "externalizes" gitlinks in the same way as the normal
patch generation codepath does (i.e. "Subproject commit Xxx\n") to fix the
issue.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-04-29 12:49:52 -07:00
Linus Torvalds c922b01f54 grep: fix segfault when "git grep '('" is given
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-04-27 17:28:18 -07:00
Allan Caffee d649048e68 Documentation: fix a grammatical error in api-builtin.txt
Signed-off-by: Allan Caffee <allan.caffee@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-04-27 09:36:40 -07:00
Allan Caffee 345f6e2cb5 builtin-merge: fix a typo in an error message
Signed-off-by: Allan Caffee <allan.caffee@gmail.com>
Acked-by: Miklos Vajna <vmiklos@frugalware.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-04-27 09:36:14 -07:00
Stephen Boyd c2318228ab test-genrandom: Add newline to usage string
A minor fix to place the terminal input on a new line if test-genrandom
is run with no arguments.

Signed-off-by: Stephen Boyd <bebarino@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-04-23 01:29:00 -07:00
Markus Heidelberg 6285441044 doc/git-daemon: add missing arguments to options
Also fix some spellings and typos.

Signed-off-by: Markus Heidelberg <markus.heidelberg@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-04-18 13:39:42 -07:00
Frank Lichtenheld 32d1776b13 init: Do not segfault on big GIT_TEMPLATE_DIR environment variable
Signed-off-by: Frank Lichtenheld <flichtenheld@astaro.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-04-18 13:06:40 -07:00
Thomas Jarosch e0b3cc0dff Fix buffer overflow in config parser
When interpreting a config value, the config parser reads in 1+ space
character(s) and puts -one- space character in the buffer as soon as
the first non-space character is encountered (if not inside quotes).

Unfortunately the buffer size check lacks the extra space character
which gets inserted at the next non-space character, resulting in
a crash with a specially crafted config entry.

The unit test now uses Java to compile a platform independent
.NET framework to output the test string in C# :o)

    Read: Thanks to Johannes Sixt for the correct printf call
    which replaces the perl invocation.

Signed-off-by: Thomas Jarosch <thomas.jarosch@intra2net.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-04-17 20:59:01 -07:00
Daniel Cheng (aka SDiZ) c6d8f7635f State the effect of filter-branch on graft explicitly
Signed-off-by: Daniel Cheng (aka SDiZ) <j16sdiz+freenet@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-04-12 14:30:40 -07:00
Linus Torvalds 213152688c process_{tree,blob}: Remove useless xstrdup calls
On Wed, 8 Apr 2009, Björn Steinbrink wrote:
>
> The name of the processed object was duplicated for passing it to
> add_object(), but that already calls path_name, which allocates a new
> string anyway. So the memory allocated by the xstrdup calls just went
> nowhere, leaking memory.

Ack, ack.

There's another easy 5% or so for the built-in object walker: once we've
created the hash from the name, the name isn't interesting any more, and
so something trivial like this can help a bit.

Does it matter? Probably not on its own. But a few more memory saving
tricks and it might all make a difference.

		Linus

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-04-12 14:30:31 -07:00
Björn Steinbrink de551d472e process_{tree,blob}: Remove useless xstrdup calls
The name of the processed object was duplicated for passing it to
add_object(), but that already calls path_name, which allocates a new
string anyway. So the memory allocated by the xstrdup calls just went
nowhere, leaking memory.

This reduces the RSS usage for a "rev-list --all --objects" by about 10% on
the gentoo repo (fully packed) as well as linux-2.6.git:

    gentoo:
                    | old           | new
    ----------------|-------------------------------
    RSS             |       1537284 |       1388408
    VSZ             |       1816852 |       1667952
    time elapsed    |       1:49.62 |       1:48.99
    min. page faults|        417178 |        379919

    linux-2.6.git:
                    | old           | new
    ----------------|-------------------------------
    RSS             |        324452 |        292996
    VSZ             |        491792 |        460376
    time elapsed    |       0:14.53 |       0:14.28
    min. page faults|         89360 |         81613

Signed-off-by: Björn Steinbrink <B.Steinbrink@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-04-08 22:58:43 -07:00
Jason Merrill 20ff3ec28e Documentation: clarify .gitattributes search
Use the term "toplevel of the work tree" in gitattributes.txt and
gitignore.txt to define the limits of the search for those files.

Signed-off-by: Jason Merrill <jason@redhat.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-04-07 21:58:25 -07:00
Matthieu Moy 39470cf961 git-checkout.txt: clarify that <branch> applies when no path is given.
Otherwise, the sentence "Defaults to HEAD." can be mis-read to mean
that "git checkout -- hello.c" checks-out from HEAD.

Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-04-07 21:57:12 -07:00
Matthieu Moy ce8936c342 git-checkout.txt: fix incorrect statement about HEAD and index
The command "git checkout" checks out from the index by default, not
HEAD (the introducing comment were correct, but the detailled
explanation added below were not).

Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-04-07 21:56:41 -07:00
Jeff King 4f6a32f8af commit: abort commit if interactive add failed
Previously we ignored the result of calling add_interactive,
which meant that if an error occurred we simply committed
whatever happened to be in the index.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-04-05 00:37:32 -07:00
Dan McGee e1dc49bcde git-repack: use non-dashed update-server-info
Signed-off-by: Dan McGee <dpmcgee@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-04-05 00:08:49 -07:00
Holger Weiß 5bd27ebb18 Documentation: Remove an odd "instead"
Signed-off-by: Holger Weiß <holger@zedat.fu-berlin.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-04-01 11:34:02 -07:00
Daniel Cheng (aka SDiZ) ba7906f2f4 Fix bash completion in path with spaces
Signed-off-by: Daniel Cheng (aka SDiZ) <j16sdiz+freenet@gmail.com>
Trivially-acked-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-03-30 09:07:03 -07:00
Thomas Rast 67f1fe5f08 bash completion: only show 'log --merge' if merging
The gitk completion only shows --merge if MERGE_HEAD is present.
Do it the same way for git-log completion.

Signed-off-by: Thomas Rast <trast@student.ethz.ch>
Acked-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-03-30 09:06:48 -07:00
Nico -telmich- Schottelius abfd5fa872 git-tag(1): add hint about commit messages
If a tag is not annotated, git tag displays the commit message
instead. Add this hint to the manpage to unhide this secret.

Signed-off-by: Nico Schottelius <nico@ikn.schottelius.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-03-30 09:00:04 -07:00
Allan Caffee 7b60d0d3e4 Documentation: update graph api example.
As of commit 03300c0 the graph API uses '*' for all nodes including merges.
This updates the example in the documentation to match.

Signed-off-by: Allan Caffee <allan.caffee@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-03-30 08:59:45 -07:00
Johannes Schindelin 63801da88d import-zips: fix thinko
Embarrassingly, the common prefix calculation did not work properly, due
to a mistake in the assignment: instead of assigning the dirname of the
current file name, the dirname of the current common prefix needs to
be assigned to common prefix, when the current prefix does not match the
current file name.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-03-29 19:56:26 -07:00
Linus Torvalds e8bd78c3fc close_sha1_file(): make it easier to diagnose errors
A bug report with "unable to write sha1 file" made us realize that we do
not have enough information to guess why close() is failing.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-03-24 14:39:20 -07:00
Nicolas Pitre 720fe22d50 avoid possible overflow in delta size filtering computation
On a 32-bit system, the maximum possible size for an object is less than
4GB, while 64-bit systems may cope with larger objects.  Due to this
limitation, variables holding object sizes are using an unsigned long
type (32 bits on 32-bit systems, or 64 bits on 64-bit systems).

When large objects are encountered, and/or people play with large delta
depth values, it is possible for the maximum allowed delta size
computation to overflow, especially on a 32-bit system.  When this
occurs, surviving result bits may represent a value much smaller than
what it is supposed to be, or even zero.  This prevents some objects
from being deltified although they do get deltified when a smaller depth
limit is used.  Fix this by always performing a 64-bit multiplication.

Signed-off-by: Nicolas Pitre <nico@cam.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-03-24 14:37:30 -07:00
David Aguilar 3e5970a41e everyday: use the dashless form of git-init
The 'Everyday GIT' guide was using the old dashed form
of git-init.

Signed-off-by: David Aguilar <davvid@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-03-22 10:33:36 -07:00
Junio C Hamano 688ba09cad Merge branch 'ks/maint-1.6.0-mailinfo-folded' into maint-1.6.0
* ks/maint-1.6.0-mailinfo-folded:
  mailinfo: tests for RFC2047 examples
  mailinfo: add explicit test for mails like '<a.u.thor@example.com> (A U Thor)'
  mailinfo: 'From:' header should be unfold as well
  mailinfo: correctly handle multiline 'Subject:' header
2009-03-12 21:48:43 -07:00
Junio C Hamano 3e186ef135 Merge branch 'cc/maint-1.6.0-bisect-fix' into maint-1.6.0
* cc/maint-1.6.0-bisect-fix:
  bisect: fix another instance of eval'ed string
  bisect: fix quoting TRIED revs when "bad" commit is also "skip"ped
2009-03-12 21:48:26 -07:00
Junio C Hamano fa711bc198 Merge branch 'fg/maint-1.6.0-exclude-bq' into maint-1.6.0
* fg/maint-1.6.0-exclude-bq:
  Support "\" in non-wildcard exclusion entries
2009-03-12 21:48:07 -07:00
Junio C Hamano de55390d36 Merge branch 'jc/maint-1.6.0-split-diff-metainfo' into maint-1.6.0
* jc/maint-1.6.0-split-diff-metainfo:
  diff.c: output correct index lines for a split diff
2009-03-12 20:01:28 -07:00
Danijel Tasov eb006ccfca added missing backtick in git-apply.txt
Signed-off-by: Danijel Tasov <dt@korn.shell.la>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-02-28 13:10:16 -08:00
Christian Couder cce074a276 bisect: fix another instance of eval'ed string
When there is nothing to be skipped, the output from
rev-list --bisect-vars was eval'ed without first being
strung together with &&; this is probably not a problem
as it is much less likely to be a bad input than the list
handcrafted by the filter_skip function, but it still is
a good discipline.

Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-02-27 14:30:34 -08:00
Christian Couder 1b249ffe8d bisect: fix quoting TRIED revs when "bad" commit is also "skip"ped
When the "bad" commit was also "skip"ped and when more than one
commit was skipped, the "filter_skipped" function would have
printed something like:

    bisect_rev=<hash1>|<hash2>

(where <hash1> and <hash2> are hexadecimal sha1 hashes)

and this would have been evaled later as piping "bisect_rev=<hash1>"
into "<hash2>", which would have failed.

So this patch makes the "filter_skipped" function properly quote
what it outputs, so that it will print something like:

bisect_rev='<hash1>|<hash2>'

which will be properly evaled later.  The caller was not stopping
properly because the scriptlet this function returned to be evaled
was not strung together with && and because of this, an error in
an earlier part of the output was simply ignored.

A test case is added to the test suite.

And while at it, we also initialize the VARS, FOUND and TRIED
variables, so that we protect ourselves from environment variables
the user may have with these names.

Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-02-27 00:57:28 -08:00
Finn Arne Gangstad dd482eeac2 Support "\" in non-wildcard exclusion entries
"\" was treated differently in exclude rules depending on whether a
wildcard match was done. For wildcard rules, "\" was de-escaped in
fnmatch, but this was not done for other rules since they used strcmp
instead.  A file named "#foo" would not be excluded by "\#foo", but would
be excluded by "\#foo*".

We now treat all rules with "\" as wildcard rules.

Another solution could be to de-escape all non-wildcard rules as we
read them, but we would have to do the de-escaping exactly as fnmatch
does it to avoid inconsistencies.

Signed-off-by: Finn Arne Gangstad <finnag@pvv.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-02-12 11:36:43 -08:00
Junio C Hamano 3e6b1d0abc Make repack less likely to corrupt repository
Some platforms refuse to rename a file that is open.  When repacking an
already packed repository without adding any new object, the resulting
pack will contain the same set of objects as an existing pack, and on such
platforms, a newly created packfile cannot replace the existing one.

The logic detected this issue but did not try hard enough to recover from
it.  Especially because the files that needs renaming come in pairs, there
potentially are different failure modes that one can be renamed but the
others cannot.  Asking manual recovery to end users were error prone.

This patch tries to make it more robust by first making sure all the
existing files that need to be renamed have been renamed before
continuing, and attempts to roll back if some failed to rename.

This is based on an initial patch by Robin Rosenberg.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-02-11 18:32:16 -08:00
Elijah Newren 784f8affe4 fast-export: ensure we traverse commits in topological order
fast-export will only list as parents those commits which have already
been traversed (making it appear as if merges have been squashed if not
all parents have been traversed).  To avoid this silent squashing of
merge commits, we request commits in topological order.

Signed-off-by: Elijah Newren <newren@gmail.com>
Acked-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-02-11 18:30:17 -08:00
Shawn O. Pearce fa3a0c94dc Clear the delta base cache if a pack is rebuilt
There is some risk that re-opening a regenerated pack file with
different offsets could leave stale entries within the delta base
cache that could be matched up against other objects using the same
"struct packed_git*" and pack offset.

Throwing away the entire delta base cache in this case is safer,
as we don't have to worry about a recycled "struct packed_git*"
matching to the wrong base object, resulting in delta apply
errors while unpacking an object.

Suggested-by: Daniel Barkalow <barkalow@iabervon.org>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-02-11 10:25:24 -08:00
Shawn O. Pearce 3d20c636af Clear the delta base cache during fast-import checkpoint
Otherwise we may reuse the same memory address for a totally
different "struct packed_git", and a previously cached object from
the prior occupant might be returned when trying to unpack an object
from the new pack.

Found-by: Daniel Barkalow <barkalow@iabervon.org>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-02-10 15:30:59 -08:00
David J. Mellor ab2fdb3b62 Fixed broken git help -w when installing from RPM
After the git-core package was renamed to git, git help -w was still looking
for files in /usr/share/doc/git-core-$VERSION instead of
/usr/share/doc/git-$VERSION.

Signed-off-by: David J. Mellor <dmellor@whistlingcat.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-02-04 22:00:49 -08:00
Matthieu Moy 5aed3c6ab8 builtin-mv.c: check for unversionned files before looking at the destination.
The previous code was failing in the case where one moves an
unversionned file to an existing destination, with mv -f: the
"existing destination" was checked first, and the error was cancelled
by the force flag.

We now check the unrecoverable error first, which fixes the bug.

Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-02-04 11:07:42 -08:00
Matthieu Moy c8ba6b1b19 Add a testcase for "git mv -f" on untracked files.
This currently fails with:
git: builtin-mv.c:217: cmd_mv: Assertion `pos >= 0' failed.

Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-02-04 11:04:56 -08:00
Matthieu Moy 720ec6b870 Missing && in t/t7001.sh.
Without this, the exit status is only the one of the last line.

Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-02-04 11:04:44 -08:00
William Pursell 7a85f6ae88 User-manual: "git stash <comment>" form is long gone
These days you must explicitly say "git stash save <comment>".

Signed-off-by: William Pursell <bill.pursell@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-02-03 22:13:47 -08:00
Guanqun Lu 37fc57a213 add test-dump-cache-tree in Makefile
5c5ba73 (Makefile: Use generic rule to build test programs,
2007-05-31) tried to use generic rule to build test programs, but it
misses the file 'dump-cache-tree.c', since its name is not prefixed by
'test-'.  This commit solves this little problem by renaming this file
instead of carrying out an explicit rule in Makefile.

Signed-off-by: Guanqun Lu <guanqun.lu@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-02-03 22:11:44 -08:00
Guanqun Lu c9a8abcf9a fix typo in Documentation
Signed-off-by: Guanqun Lu <guanqun.lu@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-02-03 22:09:03 -08:00
Johannes Schindelin e1e4389832 apply: fix access to an uninitialized mode variable, found by valgrind
When 'tpatch' was initialized successfully, st_mode was already taken
from the previous diff.  We should not try to override it with data
from an lstat() that was never called.

This is a companion patch to 7a07841(git-apply: handle a patch that
touches the same path more than once better).

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-02-03 22:04:31 -08:00
Junio C Hamano bc395643b6 grep: pass -I (ignore binary) down to external grep
We forgot to pass this option to the external grep process.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-02-02 10:58:20 -08:00
René Scharfe c7cddc1a2f merge: fix out-of-bounds memory access
The parameter n of unpack_callback() can have a value of up to
MAX_UNPACK_TREES.  The check at the top of unpack_trees() (its only
(indirect) caller) makes sure it cannot exceed this limit.

unpack_callback() passes it and the array src to unpack_nondirectories(),
which has this loop:

	for (i = 0; i < n; i++) {
		/* ... */
		src[i + o->merge] = o->df_conflict_entry;

o->merge can be 0 or 1, so unpack_nondirectories() potentially accesses
the array src at index MAX_UNPACK_TREES.  This patch makes it big enough.

Reported-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: René Scharfe <rene.scharfe@lsrfire.ath.cx>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-01-31 10:39:55 -08:00