Code

git.git
16 years agoDocumentation/git-submodule.txt: Add Description section
Petr Baudis [Wed, 16 Jul 2008 18:44:12 +0000 (20:44 +0200)]
Documentation/git-submodule.txt: Add Description section

Figuring out how submodules work conceptually is quite a bumpy
ride for a newcomer; the user manual helps (if one knows to actually
look into it), but the reference documentation should provide good
quick intro as well. This patch attempts to do that, with suggestions
from Heikki Orsila.

Cc: Heikki Orsila <shdl@zakalwe.fi>
Signed-off-by: Petr Baudis <pasky@suse.cz>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoMerge branch 'sb/dashless'
Junio C Hamano [Thu, 17 Jul 2008 00:22:50 +0000 (17:22 -0700)]
Merge branch 'sb/dashless'

* sb/dashless:
  Make usage strings dash-less
  t/: Use "test_must_fail git" instead of "! git"
  t/test-lib.sh: exit with small negagive int is ok with test_must_fail

Conflicts:
builtin-blame.c
builtin-mailinfo.c
builtin-mailsplit.c
builtin-shortlog.c
git-am.sh
t/t4150-am.sh
t/t4200-rerere.sh

16 years agoMerge branch 'rs/archive'
Junio C Hamano [Thu, 17 Jul 2008 00:12:18 +0000 (17:12 -0700)]
Merge branch 'rs/archive'

* rs/archive:
  archive: remove extra arguments parsing code
  archive: unify file attribute handling
  archive: centralize archive entry writing
  archive: add baselen member to struct archiver_args
  add context pointer to read_tree_recursive()
  archive: remove args member from struct archiver

16 years agoMerge branch 'ag/blame'
Junio C Hamano [Thu, 17 Jul 2008 00:12:11 +0000 (17:12 -0700)]
Merge branch 'ag/blame'

* ag/blame:
  Do not try to detect move/copy for entries below threshold.
  Avoid rescanning unchanged entries in search for copies.

16 years agoMerge branch 'rs/rebase-checkout-not-so-quiet'
Junio C Hamano [Thu, 17 Jul 2008 00:12:09 +0000 (17:12 -0700)]
Merge branch 'rs/rebase-checkout-not-so-quiet'

* rs/rebase-checkout-not-so-quiet:
  git-rebase: report checkout failure

Conflicts:
git-rebase.sh

16 years agoMerge branch 'sp/maint-index-pack'
Junio C Hamano [Thu, 17 Jul 2008 00:11:18 +0000 (17:11 -0700)]
Merge branch 'sp/maint-index-pack'

* sp/maint-index-pack:
  index-pack: Honor core.deltaBaseCacheLimit when resolving deltas
  index-pack: Track the object_entry that creates each base_data
  index-pack: Chain the struct base_data on the stack for traversal
  index-pack: Refactor base arguments of resolve_delta into a struct

16 years agoMerge branch 'maint'
Junio C Hamano [Thu, 17 Jul 2008 00:10:28 +0000 (17:10 -0700)]
Merge branch 'maint'

* maint:
  Start preparing 1.5.6.4 release notes
  git fetch-pack: do not complain about "no common commits" in an empty repo
  rebase-i: keep old parents when preserving merges
  t7600-merge: Use test_expect_failure to test option parsing
  Fix buffer overflow in prepare_attr_stack
  Fix buffer overflow in git diff
  Fix buffer overflow in git-grep
  git-cvsserver: fix call to nonexistant cleanupWorkDir()
  Documentation/git-cherry-pick.txt et al.: Fix misleading -n description

Conflicts:
RelNotes

16 years agoStart preparing 1.5.6.4 release notes
Junio C Hamano [Wed, 16 Jul 2008 22:55:51 +0000 (15:55 -0700)]
Start preparing 1.5.6.4 release notes

Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agogit fetch-pack: do not complain about "no common commits" in an empty repo
Johannes Schindelin [Wed, 2 Jul 2008 17:06:56 +0000 (18:06 +0100)]
git fetch-pack: do not complain about "no common commits" in an empty repo

If the repo is empty, it is obvious that there are no common commits
when fetching from _anywhere_.

So there is no use in saying it in that case, and it can even be
annoying.  Therefore suppress the message unilaterally if the repository
is empty prior to the fetch.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoMerge branch 'js/maint-pretty-mailmap' into maint
Junio C Hamano [Wed, 16 Jul 2008 22:27:03 +0000 (15:27 -0700)]
Merge branch 'js/maint-pretty-mailmap' into maint

* js/maint-pretty-mailmap:
  Add pretty format %aN which gives the author name, respecting .mailmap

16 years agoMerge branch 'sp/maint-bash-completion-optim' into maint
Junio C Hamano [Wed, 16 Jul 2008 22:25:24 +0000 (15:25 -0700)]
Merge branch 'sp/maint-bash-completion-optim' into maint

* sp/maint-bash-completion-optim:
  bash completion: Resolve git show ref:path<tab> losing ref: portion
  bash completion: Append space after file names have been completed
  bash completion: Don't offer "a.." as a completion for "a."
  bash completion: Improve responsiveness of git-log completion

16 years agoMerge branch 'sp/maint-pack-memuse' into maint
Junio C Hamano [Wed, 16 Jul 2008 22:24:07 +0000 (15:24 -0700)]
Merge branch 'sp/maint-pack-memuse' into maint

* sp/maint-pack-memuse:
  Correct pack memory leak causing git gc to try to exceed ulimit

16 years agoMerge branch 'ls/maint-mailinfo-patch-label' into maint
Junio C Hamano [Wed, 16 Jul 2008 22:23:19 +0000 (15:23 -0700)]
Merge branch 'ls/maint-mailinfo-patch-label' into maint

* ls/maint-mailinfo-patch-label:
  git-mailinfo: Fix getting the subject from the in-body [PATCH] line

16 years agoMerge branch 'js/maint-daemon-syslog' into maint
Junio C Hamano [Wed, 16 Jul 2008 22:22:05 +0000 (15:22 -0700)]
Merge branch 'js/maint-daemon-syslog' into maint

* js/maint-daemon-syslog:
  git daemon: avoid calling syslog() from a signal handler

16 years agorebase-i: keep old parents when preserving merges
Stephan Beyer [Wed, 16 Jul 2008 01:51:49 +0000 (03:51 +0200)]
rebase-i: keep old parents when preserving merges

When "rebase -i -p" tries to preserve merges of unrelated branches, it
lost some parents:

 - When you have more than two parents, the commit in the new history
   ends up with fewer than expected number of parents and this breakage
   goes unnoticed;

 - When you are rebasing a merge with two parents and one is lost, the
   command tries to cherry-pick the original merge commit, and the command
   fails.

Signed-off-by: Stephan Beyer <s-beyer@gmx.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agot7600-merge: Use test_expect_failure to test option parsing
Johannes Sixt [Wed, 16 Jul 2008 08:33:52 +0000 (10:33 +0200)]
t7600-merge: Use test_expect_failure to test option parsing

It used plain 'if git merge ...', which hides a segfault. The test does not pass.

Signed-off-by: Johannes Sixt <johannes.sixt@telecom.at>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoFix buffer overflow in prepare_attr_stack
Dmitry Potapov [Wed, 16 Jul 2008 15:39:55 +0000 (19:39 +0400)]
Fix buffer overflow in prepare_attr_stack

If PATH_MAX on your system is smaller than a path stored in the git repo,
it may cause the buffer overflow in prepare_attr_stack.

Signed-off-by: Dmitry Potapov <dpotapov@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoFix buffer overflow in git diff
Dmitry Potapov [Wed, 16 Jul 2008 14:54:02 +0000 (18:54 +0400)]
Fix buffer overflow in git diff

If PATH_MAX on your system is smaller than a path stored, it may cause
buffer overflow and stack corruption in diff_addremove() and diff_change()
functions when running git-diff

Signed-off-by: Dmitry Potapov <dpotapov@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoFix buffer overflow in git-grep
Dmitry Potapov [Wed, 16 Jul 2008 15:33:29 +0000 (19:33 +0400)]
Fix buffer overflow in git-grep

If PATH_MAX on your system is smaller than any path stored in the git
repository, that can cause memory corruption inside of the grep_tree
function used by git-grep.

Signed-off-by: Dmitry Potapov <dpotapov@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agot/Makefile: use specified shell when running aggregation script
SungHyun Nam [Wed, 16 Jul 2008 01:31:28 +0000 (10:31 +0900)]
t/Makefile: use specified shell when running aggregation script

Signed-off-by: SungHyun Nam <goweol@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agogit-cvsserver: fix call to nonexistant cleanupWorkDir()
Lars Noschinski [Wed, 16 Jul 2008 11:35:46 +0000 (13:35 +0200)]
git-cvsserver: fix call to nonexistant cleanupWorkDir()

git-cvsserver.perl contained a single call to a nonexistant function
cleanupWorkDir(). This was obviously a typo for cleanupWorkTree().

Signed-off-by: Lars Noschinski <lars@public.noschinski.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoparse-options.c: make check_typos() static
Nanako Shiraishi [Wed, 16 Jul 2008 10:42:18 +0000 (19:42 +0900)]
parse-options.c: make check_typos() static

This function is not used by any other file.

Signed-off-by: Nanako Shiraishi <nanako3@lavabit.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agobuiltin-describe.c: make a global variable "pattern" static
Nanako Shiraishi [Wed, 16 Jul 2008 10:42:14 +0000 (19:42 +0900)]
builtin-describe.c: make a global variable "pattern" static

This variable is not used by any other file.

Signed-off-by: Nanako Shiraishi <nanako3@lavabit.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agocache-tree.c: make cache_tree_find() static
Nanako Shiraishi [Wed, 16 Jul 2008 10:42:10 +0000 (19:42 +0900)]
cache-tree.c: make cache_tree_find() static

This function is not used by any other file.

Signed-off-by: Nanako Shiraishi <nanako3@lavabit.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoDocumentation/git-cherry-pick.txt et al.: Fix misleading -n description
Petr Baudis [Wed, 16 Jul 2008 12:35:22 +0000 (14:35 +0200)]
Documentation/git-cherry-pick.txt et al.: Fix misleading -n description

The manual page of git-cherry-pick and git-revert asserts that -n works
primarily on the working tree, while in fact the primary object it operates
on is the index, and the changes only "accidentally" propagate to the
working tree. This e.g. leads innocent #git IRC folks to believe that you
can use -n to prepare changes for git-add -i staging.

Signed-off-by: Petr Baudis <pasky@suse.cz>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agot/aggregate-results: whitespace fix
Junio C Hamano [Wed, 16 Jul 2008 15:42:52 +0000 (08:42 -0700)]
t/aggregate-results: whitespace fix

Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agot/lib-git-svn: fix SVN_HTTPD tests to work with "trash directory"
Eric Wong [Mon, 14 Jul 2008 09:13:56 +0000 (02:13 -0700)]
t/lib-git-svn: fix SVN_HTTPD tests to work with "trash directory"

Signed-off-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoMerge branch 'mv/merge-in-c'
Junio C Hamano [Wed, 16 Jul 2008 02:09:46 +0000 (19:09 -0700)]
Merge branch 'mv/merge-in-c'

* mv/merge-in-c:
  reduce_heads(): protect from duplicate input
  reduce_heads(): thinkofix
  Add a new test for git-merge-resolve
  t6021: add a new test for git-merge-resolve
  Teach merge.log to "git-merge" again
  Build in merge
  Fix t7601-merge-pull-config.sh on AIX
  git-commit-tree: make it usable from other builtins
  Add new test case to ensure git-merge prepends the custom merge message
  Add new test case to ensure git-merge reduces octopus parents when possible
  Introduce reduce_heads()
  Introduce get_merge_bases_many()
  Add new test to ensure git-merge handles more than 25 refs.
  Introduce get_octopus_merge_bases() in commit.c
  git-fmt-merge-msg: make it usable from other builtins
  Move read_cache_unmerged() to read-cache.c
  Add new test to ensure git-merge handles pull.twohead and pull.octopus
  Move parse-options's skip_prefix() to git-compat-util.h
  Move commit_list_count() to commit.c
  Move split_cmdline() to alias.c

Conflicts:
Makefile
parse-options.c

16 years agoMerge branch 'ag/rewrite_one'
Junio C Hamano [Wed, 16 Jul 2008 01:59:48 +0000 (18:59 -0700)]
Merge branch 'ag/rewrite_one'

* ag/rewrite_one:
  Fix quadratic performance in rewrite_one.

16 years agoMerge branch 'sp/win'
Junio C Hamano [Wed, 16 Jul 2008 01:59:45 +0000 (18:59 -0700)]
Merge branch 'sp/win'

* sp/win:
  We need to check for msys as well as Windows in add--interactive.
  Convert CR/LF to LF in tag signatures
  Fixed text file auto-detection: treat EOF character 032 at the end of file as printable

16 years agoMerge branch 'js/more-win'
Junio C Hamano [Wed, 16 Jul 2008 01:59:28 +0000 (18:59 -0700)]
Merge branch 'js/more-win'

* js/more-win:
  help (Windows): Display HTML in default browser using Windows' shell API
  help.c: Add support for htmldir relative to git_exec_path()
  Move code interpreting path relative to exec-dir to new function system_path()

16 years agoMerge branch 'js/maint-pretty-mailmap'
Junio C Hamano [Wed, 16 Jul 2008 01:59:04 +0000 (18:59 -0700)]
Merge branch 'js/maint-pretty-mailmap'

* js/maint-pretty-mailmap:
  Add pretty format %aN which gives the author name, respecting .mailmap

16 years agoRename ".dotest/" to ".git/rebase" and ".dotest-merge" to "rebase-merge"
Johannes Schindelin [Wed, 16 Jul 2008 01:33:44 +0000 (03:33 +0200)]
Rename ".dotest/" to ".git/rebase" and ".dotest-merge" to "rebase-merge"

Since the files generated and used during a rebase are never to be
tracked, they should live in $GIT_DIR.  While at it, avoid the rather
meaningless term "dotest" to "rebase", and unhide ".dotest-merge".

This was wished for on the mailing list, but so far unimplemented.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoDo not try to detect move/copy for entries below threshold.
Alexander Gavrilov [Tue, 15 Jul 2008 22:00:58 +0000 (02:00 +0400)]
Do not try to detect move/copy for entries below threshold.

Splits for such entries are rejected anyway, so there is no
point even trying to compute them.

Signed-off-by: Alexander Gavrilov <angavrilov@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoAvoid rescanning unchanged entries in search for copies.
Alexander Gavrilov [Tue, 15 Jul 2008 22:05:20 +0000 (02:05 +0400)]
Avoid rescanning unchanged entries in search for copies.

Repeatedly comparing the same entry against the same set
of blobs in search for copies is quite pointless. This
huge waste of effort can be avoided using a flag in
the blame_entry structure.

Signed-off-by: Alexander Gavrilov <angavrilov@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoUpdate draft release notes to 1.6.0
Junio C Hamano [Tue, 15 Jul 2008 12:55:55 +0000 (05:55 -0700)]
Update draft release notes to 1.6.0

Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoshortlog: support --pretty=format: option
Johannes Schindelin [Mon, 14 Jul 2008 18:08:52 +0000 (19:08 +0100)]
shortlog: support --pretty=format: option

With this patch, the user can override the default setting, to print
the commit messages using a user format instead of the onelines of the
commits.  Example:

$ git shortlog --pretty='format:%s (%h)' <commit>..

Note that shortlog will only respect a user format setting, as the other
formats do not make much sense.

Wished for by Andrew Morton.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoMake git-add -i accept ranges like 7-
Ciaran McCreesh [Mon, 14 Jul 2008 18:29:37 +0000 (19:29 +0100)]
Make git-add -i accept ranges like 7-

git-add -i ranges expect number-number. But for the supremely lazy, typing in
that second number when selecting "from patch 7 to the end" is wasted effort.
So treat an empty second number in a range as "until the last item".

Signed-off-by: Ciaran McCreesh <ciaran.mccreesh@googlemail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agot9600: allow testing with cvsps 2.2, including beta versions
Pavel Roskin [Tue, 15 Jul 2008 00:20:19 +0000 (20:20 -0400)]
t9600: allow testing with cvsps 2.2, including beta versions

We've supported cvsps 2.1 so far.  Newer 2.2b1 (beta) seems to work with
us, too.

Signed-off-by: Pavel Roskin <proski@gnu.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoarchive: remove extra arguments parsing code
René Scharfe [Mon, 14 Jul 2008 19:22:05 +0000 (21:22 +0200)]
archive: remove extra arguments parsing code

Replace the code that calls backend specific argument parsers by a
simple flag mechanism.  This reduces code size and complexity.

We can add back such a mechanism (based on incremental parse_opt(),
perhaps) when we need it.  The compression level parameter, though,
is going to be shared by future compressing backends like tgz.

Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoarchive: unify file attribute handling
René Scharfe [Mon, 14 Jul 2008 19:22:29 +0000 (21:22 +0200)]
archive: unify file attribute handling

Now that all file attribute handling for git archive has moved to archive.c,
we can unexport sha1_file_to_archive() and is_archive_path_ignored() even
disappears.

Add setup_archive_check(), modelled after similar functions used in the code
of other commands that support multiple file attributes.

Also remove convert_to_archive(), as it's only remaining function with
attribute handling gone was to call format_subst() if commit was not NULL,
which is now checked in sha1_file_to_archive().

Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoarchive: centralize archive entry writing
René Scharfe [Mon, 14 Jul 2008 19:22:24 +0000 (21:22 +0200)]
archive: centralize archive entry writing

Add the exported function write_archive_entries() to archive.c, which uses
the new ability of read_tree_recursive() to pass a context pointer to its
callback in order to centralize previously duplicated code.

The new callback function write_archive_entry() does the work that every
archiver backend needs to do: loading file contents, entering subdirectories,
handling file attributes, constructing the full path of the entry.  All that
done, it calls the backend specific write_archive_entry_fn_t function.

Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoarchive: add baselen member to struct archiver_args
René Scharfe [Tue, 15 Jul 2008 07:49:38 +0000 (09:49 +0200)]
archive: add baselen member to struct archiver_args

Calculate the length of base and save it in a new member of struct
archiver_args.  This way we don't have to compute it in each of the
format backends.

Note: parse_archive_args() guarantees that ->base won't ever be NULL.

Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoadd context pointer to read_tree_recursive()
René Scharfe [Mon, 14 Jul 2008 19:22:12 +0000 (21:22 +0200)]
add context pointer to read_tree_recursive()

Add a pointer parameter to read_tree_recursive(), which is passed to the
callback function.  This allows callers of read_tree_recursive() to
share data with the callback without resorting to global variables.  All
current callers pass NULL.

Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoarchive: remove args member from struct archiver
René Scharfe [Tue, 15 Jul 2008 07:49:40 +0000 (09:49 +0200)]
archive: remove args member from struct archiver

Pass struct archiver and struct archiver_args explicitly to parse_archive_args
and remove the latter from the former.  This allows us to get rid of struct
archiver_desc and simplifies the code a bit.

Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoindex-pack: Honor core.deltaBaseCacheLimit when resolving deltas
Shawn O. Pearce [Tue, 15 Jul 2008 04:45:34 +0000 (04:45 +0000)]
index-pack: Honor core.deltaBaseCacheLimit when resolving deltas

If we are trying to resolve deltas for a long delta chain composed
of multi-megabyte objects we can easily run into requiring 500M+
of memory to hold each object in the chain on the call stack while
we recurse into the dependent objects and resolve them.

We now use a simple delta cache that discards objects near the
bottom of the call stack first, as they are the most least recently
used objects in this current delta chain.  If we recurse out of a
chain we may find the base object is no longer available, as it was
free'd to keep memory under the deltaBaseCacheLimit.  In such cases
we must unpack the base object again, which will require recursing
back to the root of the top of the delta chain as we released that
root first.

The astute reader will probably realize that we can still exceed
the delta base cache limit, but this happens only if the most
recent base plus the delta plus the inflated dependent sum up to
more than the base cache limit.  Due to the way patch_delta is
currently implemented we cannot operate in less memory anyway.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoindex-pack: Track the object_entry that creates each base_data
Shawn O. Pearce [Mon, 14 Jul 2008 02:07:46 +0000 (22:07 -0400)]
index-pack: Track the object_entry that creates each base_data

If we free the data stored within a base_data we need the struct
object_entry to get the data back again for use with another dependent
delta.  Storing the object_entry* in base_data makes it simple to call
get_data_from_pack() to recover the compressed information.

This however means that we must add the missing base object to the end of
our packfile prior to calling resolve_delta() on each of the dependent
deltas.  Adding the base first ensures we can read the base back from the
pack we are indexing, as if it had been included by the remote side.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoindex-pack: Chain the struct base_data on the stack for traversal
Shawn O. Pearce [Mon, 14 Jul 2008 02:07:45 +0000 (22:07 -0400)]
index-pack: Chain the struct base_data on the stack for traversal

We need to release earlier inflated base objects when memory gets
low, which means we need to be able to walk up or down the stack
to locate the objects we want to release, and free their data.

The new link/unlink routines allow inserting and removing the struct
base_data during recursion inside resolve_delta, and the global
base_cache gives us the head of the chain (bottom of the stack)
so we can traverse it.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoindex-pack: Refactor base arguments of resolve_delta into a struct
Shawn O. Pearce [Mon, 14 Jul 2008 02:07:44 +0000 (22:07 -0400)]
index-pack: Refactor base arguments of resolve_delta into a struct

We need to discard base objects which are not recently used if our
memory gets low, such as when we are unpacking a long delta chain
of a very large object.

To support tracking the available base objects we combine the
pointer and size into a struct.  Future changes would allow the
data pointer to be free'd and marked NULL if memory gets low.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoMerge git://repo.or.cz/git-gui
Junio C Hamano [Tue, 15 Jul 2008 07:08:02 +0000 (00:08 -0700)]
Merge git://repo.or.cz/git-gui

* git://repo.or.cz/git-gui:
  git-gui: MERGE_RR lives in .git/ directly with newer Git versions
  git-gui: Exit shortcut in MacOSX repaired

16 years agoMerge branch 'js/merge-rr'
Junio C Hamano [Tue, 15 Jul 2008 06:48:48 +0000 (23:48 -0700)]
Merge branch 'js/merge-rr'

* js/merge-rr:
  Move MERGE_RR from .git/rr-cache/ into .git/

Conflicts:
builtin-rerere.c

16 years agoMerge branch 'sb/rerere-lib'
Junio C Hamano [Tue, 15 Jul 2008 06:47:48 +0000 (23:47 -0700)]
Merge branch 'sb/rerere-lib'

* sb/rerere-lib:
  rerere: Separate libgit and builtin functions

16 years agoMerge branch 'ls/maint-mailinfo-patch-label'
Junio C Hamano [Tue, 15 Jul 2008 06:47:23 +0000 (23:47 -0700)]
Merge branch 'ls/maint-mailinfo-patch-label'

* ls/maint-mailinfo-patch-label:
  git-mailinfo: Fix getting the subject from the in-body [PATCH] line

16 years agoMerge branch 'om/rerere-careful'
Junio C Hamano [Tue, 15 Jul 2008 06:47:14 +0000 (23:47 -0700)]
Merge branch 'om/rerere-careful'

* om/rerere-careful:
  builtin-rerere: more carefully find conflict markers

16 years agoMerge branch 'jc/branch-merged'
Junio C Hamano [Tue, 15 Jul 2008 06:47:01 +0000 (23:47 -0700)]
Merge branch 'jc/branch-merged'

* jc/branch-merged:
  branch --merged/--no-merged: allow specifying arbitrary commit
  branch --contains: default to HEAD
  parse-options: add PARSE_OPT_LASTARG_DEFAULT flag

Conflicts:
Documentation/git-branch.txt

16 years agoMerge branch 'jc/rebase-orig-head'
Junio C Hamano [Tue, 15 Jul 2008 06:45:49 +0000 (23:45 -0700)]
Merge branch 'jc/rebase-orig-head'

* jc/rebase-orig-head:
  Documentation: mention ORIG_HEAD in am, merge, and rebase
  Teach "am" and "rebase" to mark the original position with ORIG_HEAD

16 years agobash completion: Remove dashed command completion support
Shawn O. Pearce [Tue, 15 Jul 2008 05:58:06 +0000 (05:58 +0000)]
bash completion: Remove dashed command completion support

Since only 'git' and 'gitk' are in the user's $PATH now we do not
expect users to need completion support for git-fetch, and expect
they will instead rely upon the completion support for 'git fetch'.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoMerge branch 'sp/maint-bash-completion-optim'
Junio C Hamano [Tue, 15 Jul 2008 06:36:08 +0000 (23:36 -0700)]
Merge branch 'sp/maint-bash-completion-optim'

* sp/maint-bash-completion-optim:
  bash completion: Resolve git show ref:path<tab> losing ref: portion
  bash completion: Append space after file names have been completed

16 years agorestore legacy behavior for read_sha1_file()
Nicolas Pitre [Tue, 15 Jul 2008 01:46:48 +0000 (21:46 -0400)]
restore legacy behavior for read_sha1_file()

Since commit 8eca0b47ff1598a6d163df9358c0e0c9bd92d4c8, it is possible
for read_sha1_file() to return NULL even with existing objects when they
are corrupted.  Previously a corrupted object would have terminated the
program immediately, effectively making read_sha1_file() return NULL
only when specified object is not found.

Let's restore this behavior for all users of read_sha1_file() and
provide a separate function with the ability to not terminate when
bad objects are encountered.

Signed-off-by: Nicolas Pitre <nico@cam.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agobash: Add long option completion for 'git send-email'
Teemu Likonen [Mon, 14 Jul 2008 08:21:02 +0000 (11:21 +0300)]
bash: Add long option completion for 'git send-email'

Add the following long options to be completed with 'git send-email':

    --bcc --cc --cc-cmd --chain-reply-to --compose --dry-run
    --envelope-sender --from --identity --in-reply-to
    --no-chain-reply-to --no-signed-off-by-cc --no-suppress-from
    --no-thread --quiet --signed-off-by-cc --smtp-pass --smtp-server
    --smtp-server-port --smtp-ssl --smtp-user --subject --suppress-cc
    --suppress-from --thread --to

Short ones like --to and --cc are not usable for actual completion
because of the shortness itself and because there are longer ones which
start with same letters (--thread, --compose). It's still useful to have
these shorter options _listed_ when user presses TAB key after typing
two dashes. It gives user an idea what options are available (and --to
and --cc are probably the most commonly used).

Signed-off-by: Teemu Likonen <tlikonen@iki.fi>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agogit-submodule - register submodule URL if adding in place
Mark Levedahl [Thu, 10 Jul 2008 01:05:41 +0000 (21:05 -0400)]
git-submodule - register submodule URL if adding in place

When adding a new submodule in place, meaning the user created the
submodule as a git repo in the superproject's tree first, we don't go
through "git submodule init" to register the module.  Thus, the
submodule's origin repository URL is not stored in .git/config, and no
subsequent submodule operation will ever do so.  In this case, assume the
URL the user supplies to "submodule add" is the one that should be
registered, and do so.

Signed-off-by: Mark Levedahl <mlevedahl@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agogit-submodule - make "submodule add" more strict, and document it
Mark Levedahl [Thu, 10 Jul 2008 01:05:40 +0000 (21:05 -0400)]
git-submodule - make "submodule add" more strict, and document it

This change makes "submodule add" much more strict in the arguments it
takes, and is intended to address confusion as recently noted on the
git-list. With this change, the required syntax is:

$ git submodule add URL path

Specifically, this eliminates the form

$ git submodule add URL

which was confused by more than one person as

$ git submodule add path

With this patch, the URL locating the submodule's origin repository can be
either an absolute URL, or (if it begins with ./ or ../) can express the
submodule's repository location relative to the superproject's origin.

This patch also eliminates a third form of URL, which was relative to the
superproject's top-level directory (not its repository).  Any URL that was
neither absolute nor matched ./*|../* was assumed to point to a
subdirectory of the superproject as the location of the submodule's origin
repository.  This URL form was confusing and does not seem to correspond
to an important use-case.  Specifically, no-one has identified the need to
clone from a repository already in the superproject's tree, but if this is
needed it is easily done using an absolute URL: $(pwd)/relative-path.  So,
no functionality is lost with this patch. (t6008-rev-list-submodule.sh did
rely upon this relative URL, fixed by using $(pwd).)

Following this change, there are exactly four variants of
submodule-add, as both arguments have two flavors:

URL can be absolute, or can begin with ./|../ and thus names the
submodule's origin relative to the superproject's origin.

Note: With this patch, "submodule add" discerns an absolute URL as
matching /*|*:*: e.g., URL begins with /, or it contains a :.  This works
for all valid URLs, an absolute path in POSIX, as well as an absolute path
on Windows).

path can either already exist as a valid git repo, or will be cloned from
the given URL.  The first form here eases creation of a new submodule in
an existing superproject as the submodule can be added and tested in-tree
before pushing to the public repository.  However, the more usual form is
the second, where the repo is cloned from the given URL.

This specifically addresses the issue of

$ git submodule add a/b/c

attempting to clone from a repository at "a/b/c" to create a new module
in "c". This also simplifies description of "relative URL" as there is now
exactly *one* form: a URL relative to the parent's origin repo.

Signed-off-by: Mark Levedahl <mlevedahl@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agogit-svn: typofix
Frederik Schwarzer [Mon, 14 Jul 2008 16:30:24 +0000 (18:30 +0200)]
git-svn: typofix

Signed-off-by: Frederik Schwarzer <schwarzerf@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agogit-svn: find-rev and rebase for SVN::Mirror repositories
João Abecasis [Mon, 14 Jul 2008 15:28:04 +0000 (16:28 +0100)]
git-svn: find-rev and rebase for SVN::Mirror repositories

find-rev and rebase error out on svm because git-svn doesn't trace the
original svn revision numbers back to git commits. The updated test
case, included in the patch, shows the issue and passes with the rest of
the patch applied.

This fixes Git::SVN::find_by_url to find branches based on the
svm:source URL, where useSvmProps is set. Also makes sure cmd_find_rev
and working_head_info use the information they have to correctly track
the source repository. This is enough to get find-rev and rebase
working.

Signed-off-by: João Abecasis <joao@abecasis.name>
Acked-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agotutorial: clarify "pull" is "fetch + merge"
Junio C Hamano [Thu, 10 Jul 2008 21:01:57 +0000 (14:01 -0700)]
tutorial: clarify "pull" is "fetch + merge"

The document says that a fetch with a configured remote stores what are
fetched in the remote tracking branches "Unlike the longhand form", but
there is no longhand form "fetch" demonstrated earlier.

This adds a missing demonstration of the longhand form, and a new
paragraph to explain why some people might want to fetch before pull.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agotutorial: use prompt with user names in example, to clarify who is doing what
Ian Katz [Thu, 10 Jul 2008 18:27:30 +0000 (14:27 -0400)]
tutorial: use prompt with user names in example, to clarify who is doing what

Signed-off-by: Ian Katz <ifreecarve@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agobash completion: Resolve git show ref:path<tab> losing ref: portion
Shawn O. Pearce [Tue, 15 Jul 2008 05:52:04 +0000 (05:52 +0000)]
bash completion: Resolve git show ref:path<tab> losing ref: portion

Linus reported that the bash completion for git show often dropped
the ref portion of the argument (stuff before the :) when trying
to complete a file name of a file in another branch or tag.

Björn Steinbrink tracked it down to the gvfs completion script
which comes standard on many Fedora Core based systems.  That is
removing : from COMP_WORDBREAKS, making readline treat the entire
argument (including the ref) as the name that must be completed.
When the git completion routines supplied a completion of just the
filename, readline replaced everything.

Since Git users often need to use "ref:path" or "ref:ref" sort of
arguments, and expect completion support on both sides of the :
we really want the : in COMP_WORDBREAKS to provide a good user
experience.  This is also the default that ships with bash as it
can be useful in other contexts, such as rcp/scp.

We now try to add : back to COMP_WORDBREAKS if it has been removed
by a script that loaded before us.  However if this doesn't work
(as the : is stripped after we load) we fallback in the completion
routines to include "ref:" as part of the prefix for completions,
allowing readine to fully insert the argument the user wanted.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agogit-rebase: report checkout failure
Junio C Hamano [Mon, 14 Jul 2008 21:05:35 +0000 (14:05 -0700)]
git-rebase: report checkout failure

When detaching the HEAD to the base commit, the "git checkout" command
could fail if, for example, upstream contains a file that would overrwrite
a local, untracked file.  Unconditionally discarding the standard error
stream was done to squelch the progress and notices back when checkout
did not have -q option, but there is no reason to keep doing it anymore.

Noticed by Robert Shearman.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoreduce_heads(): protect from duplicate input
Junio C Hamano [Mon, 14 Jul 2008 07:09:41 +0000 (00:09 -0700)]
reduce_heads(): protect from duplicate input

Because we do not try computing merge base with itself for obvious
reasons, the code was not prepared for an arguably insane case of
the caller feeding the same commit twice to it.

Noticed and test written by Sverre Hvammen Johansen

Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoUpdate draft release notes for 1.6.0
Junio C Hamano [Mon, 14 Jul 2008 05:30:35 +0000 (22:30 -0700)]
Update draft release notes for 1.6.0

Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agobash completion: Append space after file names have been completed
Shawn O. Pearce [Mon, 14 Jul 2008 00:22:03 +0000 (00:22 +0000)]
bash completion: Append space after file names have been completed

When completing `git show origin/maint:Makef<tab>` we should add a
space after the filename has been completed, so that the user can
immediately begin the next argument.

I also added a special case for the symlink variant so we treat it
just like a normal blob, as there are no items below it in the Git
tree structure.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agogit-mailinfo: Fix getting the subject from the in-body [PATCH] line
Lukas Sandström [Thu, 10 Jul 2008 21:41:33 +0000 (23:41 +0200)]
git-mailinfo: Fix getting the subject from the in-body [PATCH] line

"Subject: " isn't in the static array "header", and thus
memcmp("Subject:", header[i], 7) will never match.

Even if it did so, hdr_data[] may not have been allocated if there weren't
a "Subject: " in-body when we process "[PATCH]" in the affected codepath.

Signed-off-by: Lukas Sandström <lukass@etek.chalmers.se>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoMerge branch 'sp/maint-bash-completion-optim'
Junio C Hamano [Sun, 13 Jul 2008 23:41:02 +0000 (16:41 -0700)]
Merge branch 'sp/maint-bash-completion-optim'

* sp/maint-bash-completion-optim:
  bash completion: Don't offer "a.." as a completion for "a."
  bash completion: Improve responsiveness of git-log completion

16 years agobash completion: Don't offer "a.." as a completion for "a."
Shawn O. Pearce [Sun, 13 Jul 2008 22:06:31 +0000 (22:06 +0000)]
bash completion: Don't offer "a.." as a completion for "a."

If the user is trying to complete "v1.5.3.<tab>" to see all of
the available maintenance releases for 1.5.3 we should not give
them an extra dot as the completion.  Instead if the user wants
a ".." or a "..." operator they should key the two dots out on
their own.  Its the same number of keystrokes either way.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agogit-request-pull: replace call to deprecated peek-remote
Ramsay Jones [Tue, 8 Jul 2008 23:32:15 +0000 (00:32 +0100)]
git-request-pull: replace call to deprecated peek-remote

Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoMake rebase--interactive use OPTIONS_SPEC
Stephan Beyer [Sat, 12 Jul 2008 15:48:20 +0000 (17:48 +0200)]
Make rebase--interactive use OPTIONS_SPEC

Also add some checks that --continue/--abort/--skip
actions are used without --onto, -p, -t, etc.

Signed-off-by: Stephan Beyer <s-beyer@gmx.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agot3404: test two "preserve merges with -p" cases
Stephan Beyer [Sat, 12 Jul 2008 15:47:31 +0000 (17:47 +0200)]
t3404: test two "preserve merges with -p" cases

There are two cases for preserving merges:

  1. The merge base is outside the trunk that is to be rebased.
     Then commits of those other parents must not be picked.

  2. The merge base is inside the trunk that is to be rebased.
     Then all the commits related to that merge must be picked
     and the merge must be redone.

The "preserve merges with -p" test case tested for case 1 only.
This patch adds case 2.

Signed-off-by: Stephan Beyer <s-beyer@gmx.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agogit-am/git-mailsplit: correct synopsis for reading from stdin
Stephan Beyer [Sat, 12 Jul 2008 15:47:16 +0000 (17:47 +0200)]
git-am/git-mailsplit: correct synopsis for reading from stdin

Invoking git-am or git-mailsplit without mbox or Maildir results in
reading an mbox from stdin.  Mention this in the synopsis and usage
strings.

Signed-off-by: Stephan Beyer <s-beyer@gmx.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoMerge branch 'maint' to sync with 1.5.6.3
Junio C Hamano [Sun, 13 Jul 2008 22:45:38 +0000 (15:45 -0700)]
Merge branch 'maint' to sync with 1.5.6.3

* maint:
  GIT 1.5.6.3
  git-am: Do not exit silently if committer is unset
  t0004: fix timing bug
  git-mailinfo: document the -n option
  Fix backwards-incompatible handling of core.sharedRepository

16 years agoGIT 1.5.6.3 v1.5.6.3
Junio C Hamano [Sun, 13 Jul 2008 22:23:43 +0000 (15:23 -0700)]
GIT 1.5.6.3

Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoMerge branch 'ph/parseopt-step-blame'
Junio C Hamano [Sun, 13 Jul 2008 22:16:35 +0000 (15:16 -0700)]
Merge branch 'ph/parseopt-step-blame'

* ph/parseopt-step-blame:
  revisions: refactor handle_revision_opt into parse_revision_opt.
  git-shortlog: migrate to parse-options partially.
  git-blame: fix lapsus
  git-blame: migrate to incremental parse-option [2/2]
  git-blame: migrate to incremental parse-option [1/2]
  revisions: split handle_revision_opt() from setup_revisions()
  parse-opt: add PARSE_OPT_KEEP_ARGV0 parser option.
  parse-opt: fake short strings for callers to believe in.
  parse-opt: do not print errors on unknown options, return -2 intead.
  parse-opt: create parse_options_step.
  parse-opt: Export a non NORETURN usage dumper.
  parse-opt: have parse_options_{start,end}.
  git-blame --reverse
  builtin-blame.c: allow more than 16 parents
  builtin-blame.c: move prepare_final() into a separate function.
  rev-list --children
  revision traversal: --children option

16 years agoMerge branch 'am/stash-branch'
Junio C Hamano [Sun, 13 Jul 2008 22:16:09 +0000 (15:16 -0700)]
Merge branch 'am/stash-branch'

* am/stash-branch:
  Add a test for "git stash branch"
  Implement "git stash branch <newbranch> <stash>"

16 years agoMerge branch 'sg/stash-k-i'
Junio C Hamano [Sun, 13 Jul 2008 22:15:27 +0000 (15:15 -0700)]
Merge branch 'sg/stash-k-i'

* sg/stash-k-i:
  Documentation: tweak use case in "git stash save --keep-index"
  stash: introduce 'stash save --keep-index' option

16 years agoMerge branch 'jc/report-tracking'
Junio C Hamano [Sun, 13 Jul 2008 22:15:23 +0000 (15:15 -0700)]
Merge branch 'jc/report-tracking'

* jc/report-tracking:
  branch -r -v: do not spit out garbage
  stat_tracking_info(): clear object flags used during counting
  git-branch -v: show the remote tracking statistics
  git-status: show the remote tracking statistics
  Refactor "tracking statistics" code used by "git checkout"

16 years agoMerge branch 'js/pick-root'
Junio C Hamano [Sun, 13 Jul 2008 22:15:13 +0000 (15:15 -0700)]
Merge branch 'js/pick-root'

* js/pick-root:
  Allow cherry-picking root commits

16 years agoMerge branch 'ab/bundle'
Junio C Hamano [Sun, 13 Jul 2008 22:15:08 +0000 (15:15 -0700)]
Merge branch 'ab/bundle'

* ab/bundle:
  Teach git-bundle to read revision arguments from stdin like git-rev-list.

16 years agoMerge branch 'tr/add-i-e'
Junio C Hamano [Sun, 13 Jul 2008 22:14:59 +0000 (15:14 -0700)]
Merge branch 'tr/add-i-e'

* tr/add-i-e:
  git-add--interactive: manual hunk editing mode
  git-add--interactive: remove hunk coalescing
  git-add--interactive: replace hunk recounting with apply --recount

16 years agogit-gui: MERGE_RR lives in .git/ directly with newer Git versions
Johannes Schindelin [Sat, 12 Jul 2008 14:56:59 +0000 (15:56 +0100)]
git-gui: MERGE_RR lives in .git/ directly with newer Git versions

Now that MERGE_RR was moved out of .git/rr-cache/, we have to delete
it somewhere else.  Just in case somebody wants to use a newer git-gui
with an older Git, the file .git/rr-cache/MERGE_RR is removed, too (if
it exists).

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
16 years agohelp (Windows): Display HTML in default browser using Windows' shell API
Steffen Prohaska [Sun, 13 Jul 2008 20:31:20 +0000 (22:31 +0200)]
help (Windows): Display HTML in default browser using Windows' shell API

The system's default browser for displaying HTML help pages is now used
directly on Windows, instead of launching git-web--browser, which
requires a Unix shell.  Avoiding MSYS' bash when possible is good
because it avoids potential path translation issues.  In this case it is
not too hard to avoid launching a shell, so let's avoid it.

The Windows-specific code is implemented in compat/mingw.c to avoid
platform-specific code in the main code base.  On Windows, open_html is
provided as a define.  If open_html is not defined, git-web--browse is
used.  This approach avoids platform-specific ifdefs by using
per-function ifdefs.  The "ifndef open_html" together with the
introductory comment should sufficiently warn developers, so that they
hopefully will not break this mechanism.

Signed-off-by: Steffen Prohaska <prohaska@zib.de>
Signed-off-by: Johannes Sixt <johannes.sixt@telecom.at>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agohelp.c: Add support for htmldir relative to git_exec_path()
Steffen Prohaska [Sun, 13 Jul 2008 20:31:19 +0000 (22:31 +0200)]
help.c: Add support for htmldir relative to git_exec_path()

If htmldir (in the Makefile) is a relative path, this path will now be
interpreted relative to git_exec_path.  This can be used to create an
installation that can be moved to a different directory without
re-compiling.  The Windows installer (msysgit) is an example for such
a setup.

Note that the Makefile maps htmldir to the define GIT_HTML_PATH.

Signed-off-by: Steffen Prohaska <prohaska@zib.de>
Signed-off-by: Johannes Sixt <johannes.sixt@telecom.at>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoMove code interpreting path relative to exec-dir to new function system_path()
Steffen Prohaska [Sun, 13 Jul 2008 20:31:18 +0000 (22:31 +0200)]
Move code interpreting path relative to exec-dir to new function system_path()

Expanding system paths relative to git_exec_path can be used for
creating an installation that can be moved to a different directory
without re-compiling.  We use this approach for template_dir and the
system wide gitconfig.  The Windows installer (msysgit) is an example
for such a setup.

This commit moves common code to a new function system_path().  System
paths that are to be interpreted relative to git_exec_path are passed to
system_path() and the return value is used instead of the original path.
system_path() prefixes a relative path with git_exec_path and leaves
absolute paths unmodified.  For example, we now write

    template_dir = system_path(DEFAULT_GIT_TEMPLATE_DIR);

[j6t: moved from path.c to exec_cmd.c]

Signed-off-by: Steffen Prohaska <prohaska@zib.de>
Signed-off-by: Johannes Sixt <johannes.sixt@telecom.at>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoMake usage strings dash-less
Stephan Beyer [Sun, 13 Jul 2008 13:36:15 +0000 (15:36 +0200)]
Make usage strings dash-less

When you misuse a git command, you are shown the usage string.
But this is currently shown in the dashed form.  So if you just
copy what you see, it will not work, when the dashed form
is no longer supported.

This patch makes git commands show the dash-less version.

For shell scripts that do not specify OPTIONS_SPEC, git-sh-setup.sh
generates a dash-less usage string now.

Signed-off-by: Stephan Beyer <s-beyer@gmx.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoreduce_heads(): thinkofix
Sverre Hvammen Johansen [Sun, 13 Jul 2008 08:13:55 +0000 (08:13 +0000)]
reduce_heads(): thinkofix

When comparing two commit objects for equality, it is sufficient to
compare their in-core pointers because the object layer guarantees the
uniqueness.  However, comparing pointers to two "struct commit_list"
instances that point at the same commit does not make any sense.

Spotted by Sverre Hvammen Johansen who wrote an additional test to expose
the problem, fixed by Miklos Vajna.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoAdd a new test for git-merge-resolve
Miklos Vajna [Sat, 12 Jul 2008 22:33:35 +0000 (00:33 +0200)]
Add a new test for git-merge-resolve

Actually this is a simple test, just to ensure merge-resolve properly
calls read-tree. read-tree itself already has more complex tests.

Signed-off-by: Miklos Vajna <vmiklos@frugalware.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agot6021: add a new test for git-merge-resolve
Miklos Vajna [Sat, 12 Jul 2008 18:42:10 +0000 (20:42 +0200)]
t6021: add a new test for git-merge-resolve

It should fail properly if there are multiple merge bases, but there
were no test for this till now.

Signed-off-by: Miklos Vajna <vmiklos@frugalware.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoFix quadratic performance in rewrite_one.
Alexander N. Gavrilov [Sat, 12 Jul 2008 18:00:57 +0000 (22:00 +0400)]
Fix quadratic performance in rewrite_one.

Parent commits are usually older than their children. Thus,
on each iteration of the loop in rewrite_one, add_parents_to_list
traverses all commits previously processed by the loop.
It performs very poorly in case of very long rewrite chains.

Signed-off-by: Alexander Gavrilov <angavrilov@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agot/: Use "test_must_fail git" instead of "! git"
Stephan Beyer [Sat, 12 Jul 2008 15:47:52 +0000 (17:47 +0200)]
t/: Use "test_must_fail git" instead of "! git"

This patch changes every occurrence of "! git" -- with the meaning
that a git call has to gracefully fail -- into "test_must_fail git".

This is useful to

 - make sure the test does not fail because of a signal,
   e.g. SIGSEGV, and

 - advertise the use of "test_must_fail" for new tests.

Signed-off-by: Stephan Beyer <s-beyer@gmx.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agot/test-lib.sh: exit with small negagive int is ok with test_must_fail
Stephan Beyer [Sat, 12 Jul 2008 15:47:51 +0000 (17:47 +0200)]
t/test-lib.sh: exit with small negagive int is ok with test_must_fail

The test_must_fail function in test-lib.sh has been designed to
distinguish segmentation faults from controlled errors.  But in the
current implementation this only works if a git command does not return a
small negative value, like -1, -2 or -3.  But some git commands do.

Because any signal (like SIGSEGV) will result in an exit status
less than 193, this patch just adds a further check for the exit
status.

Signed-off-by: Stephan Beyer <s-beyer@gmx.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agogit-am: Do not exit silently if committer is unset
Stephan Beyer [Sat, 12 Jul 2008 15:46:59 +0000 (17:46 +0200)]
git-am: Do not exit silently if committer is unset

Signed-off-by: Stephan Beyer <s-beyer@gmx.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agobash completion: Improve responsiveness of git-log completion
Shawn O. Pearce [Sun, 13 Jul 2008 02:37:42 +0000 (02:37 +0000)]
bash completion: Improve responsiveness of git-log completion

Junio noticed the bash completion has been taking a long time lately.
Petr Baudis tracked it down to 72e5e989b ("bash: Add space after
unique command name is completed.").  Tracing the code showed
we spent significant time inside of this loop within __gitcomp,
due to the string copying overhead.

  [28.146109654] _git common over
  [28.164791148] gitrefs in
  [28.280302268] gitrefs dir out
  [28.300939737] gitcomp in
  [28.308378112] gitcomp pre-case
* [28.313407453] gitcomp iter in
* [28.701270296] gitcomp iter out
  [28.713370786] out normal

Since __git_refs avoids this string copying by forking and using
echo we use the same trick here when we need to finish generating
the names for the caller.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>