Code

git.git
16 years agoadd: refuse to add working tree items beyond symlinks
Junio C Hamano [Mon, 4 Aug 2008 07:52:37 +0000 (00:52 -0700)]
add: refuse to add working tree items beyond symlinks

This is the same fix for the issue of adding "sym/path" when "sym" is a
symblic link that points at a directory "dir" with "path" in it.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoupdate-index: refuse to add working tree items beyond symlinks
Junio C Hamano [Mon, 4 Aug 2008 07:51:42 +0000 (00:51 -0700)]
update-index: refuse to add working tree items beyond symlinks

When "sym" is a symbolic link that is inside the working tree, and it
points at a directory "dir" that has "path" in it, "update-index --add
sym/path" used to mistakenly add "sym/path" as if "sym" were a normal
directory.

"git apply", "git diff" and "git merge" have been taught about this issue
some time ago, but "update-index" and "add" have been left ignorant for
too long.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agocorrect access right for git-svn-dcommit test
Dmitry Potapov [Mon, 4 Aug 2008 15:30:24 +0000 (19:30 +0400)]
correct access right for git-svn-dcommit test

The tests requires anonymous write access. Therefore, "anon-access =
write" is added to conf/svnserve.conf. But because it was added to
the end of the file, it is impossible to guarantee in what section
it will be located. It turned out that on SVN 1.5, it was placed in
the wrong section and as result the test failed.

Signed-off-by: Dmitry Potapov <dpotapov@gmail.com>
Tested-by: Brad King <brad.king@kitware.com>
Acked-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoFix typos in INSTALL
Abhijit Menon-Sen [Tue, 5 Aug 2008 02:11:04 +0000 (07:41 +0530)]
Fix typos in INSTALL

Signed-off-by: Abhijit Menon-Sen <ams@toroid.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoFix typo in perl/Git.pm
Abhijit Menon-Sen [Tue, 5 Aug 2008 02:06:16 +0000 (07:36 +0530)]
Fix typo in perl/Git.pm

Signed-off-by: Abhijit Menon-Sen <ams@toroid.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoFix hash slice syntax error
Abhijit Menon-Sen [Mon, 4 Aug 2008 05:02:47 +0000 (10:32 +0530)]
Fix hash slice syntax error

Signed-off-by: Abhijit Menon-Sen <ams@toroid.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoGit.pm: localise $? in command_close_bidi_pipe()
Abhijit Menon-Sen [Mon, 4 Aug 2008 11:38:27 +0000 (17:08 +0530)]
Git.pm: localise $? in command_close_bidi_pipe()

Git::DESTROY calls _close_cat_blob and _close_hash_and_insert_object,
which in turn call command_close_bidi_pipe, which calls waitpid, which
alters $?. If this happens during global destruction, it may alter the
program's exit status unexpectedly. Making $? local to the function
solves the problem.

(The problem was discovered due to a failure of test #8 in
t9106-git-svn-commit-diff-clobber.sh.)

Signed-off-by: Abhijit Menon-Sen <ams@toroid.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agobash completion: Add completion for 'git grep'
Lee Marlow [Sat, 2 Aug 2008 00:56:33 +0000 (18:56 -0600)]
bash completion: Add completion for 'git grep'

Add completions for all long options specified in the docs

    --cached
    --text --ignore-case --word-regexp --invert-match
    --full-name
    --extended-regexp --basic-regexp --fixed-strings
    --files-with-matches --name-only
    --files-without-match
    --count
    --and --or --not --all-match

Signed-off-by: Lee Marlow <lee.marlow@gmail.com>
Acked-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoAdd output flushing before fork()
Anders Melchiorsen [Mon, 4 Aug 2008 10:18:40 +0000 (12:18 +0200)]
Add output flushing before fork()

This adds fflush(NULL) before fork() in start_command(), to keep
the generic interface safe.

A remaining use of fork() with no flushing is in a comment in
show_tree(). Rewrite that comment to use start_command().

Signed-off-by: Anders Melchiorsen <mail@cup.kalibalik.dk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agogit-gui: Adapt discovery of oguilib to execdir 'libexec/git-core'
Johannes Sixt [Mon, 4 Aug 2008 20:09:46 +0000 (22:09 +0200)]
git-gui: Adapt discovery of oguilib to execdir 'libexec/git-core'

The new execdir is two levels below the root directory, while
the old execdir 'bin' was only one level below.  This commit
adapts the discovery of oguilib that uses relative paths
accordingly. We determine whether we have the extra level in the same
way in which the Makefile defines sharedir, i.e. whether the last
directory part is 'git-core'.

Inspired-by: Steffen Prohaska <prohaska@zib.de>
Signed-off-by: Johannes Sixt <johannes.sixt@telecom.at>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
16 years agogit-svn: Abort with an error if 'fetch' parameter is invalid.
Avery Pennarun [Wed, 30 Jul 2008 20:53:55 +0000 (16:53 -0400)]
git-svn: Abort with an error if 'fetch' parameter is invalid.

Previously, if a config entry looked like this:

         svn-remote.svn.fetch=:refs/heads/whatever

git-svn would silently do nothing if you asked it to "git svn fetch", and
give a strange error if asked to "git svn dcommit".  What it really wants is
a line that looks like this:

svn-remote.svn.fetch=:refs/remotes/whatever

So we should simply abort if we get the wrong thing.

On the other hand, there's actually no good reason for git-svn to enforce
using the refs/remotes namespace, but the code seems to have hardcoded this
in several places and I'm not brave enough to try to fix it all right now.

Signed-off-by: Avery Pennarun <apenwarr@gmail.com>
Acked-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoFlush output in start_async
Anders Melchiorsen [Mon, 4 Aug 2008 00:30:03 +0000 (02:30 +0200)]
Flush output in start_async

This prevents double output in case stdout is redirected.

Signed-off-by: Anders Melchiorsen <mail@cup.kalibalik.dk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agogitk: Update swedish translation.
Mikael Magnusson [Sun, 3 Aug 2008 17:04:21 +0000 (19:04 +0200)]
gitk: Update swedish translation.

Signed-off-by: Paul Mackerras <paulus@samba.org>
16 years agoModify mingw_main() workaround to avoid link errors
Steffen Prohaska [Sat, 26 Jul 2008 09:41:44 +0000 (11:41 +0200)]
Modify mingw_main() workaround to avoid link errors

With MinGW's

   gcc.exe (GCC) 3.4.5 (mingw special)
   GNU ld version 2.17.50 20060824

the old define caused link errors:

   git.o: In function `main':
   C:/msysgit/git/git.c:500: undefined reference to `mingw_main'
   collect2: ld returned 1 exit status

The modified define works.

Signed-off-by: Steffen Prohaska <prohaska@zib.de>
Acked-by: Johannes Sixt <johannes.sixt@telecom.at>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoMerge branch 'maint'
Junio C Hamano [Sun, 3 Aug 2008 21:14:10 +0000 (14:14 -0700)]
Merge branch 'maint'

* maint:
  git-name-rev: don't use printf without format

16 years agoclone --bare: Add ".git" suffix to the directory name to clone into
Johannes Schindelin [Fri, 1 Aug 2008 14:01:36 +0000 (16:01 +0200)]
clone --bare: Add ".git" suffix to the directory name to clone into

We have a tradition that bare repositories live in directories ending
in ".git".  To make this more a convention than just a tradition, teach
"git clone --bare" to add a ".git" suffix to the directory name.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agogit-gui: add a part about format strings in po/README
Michele Ballabio [Sun, 3 Aug 2008 11:12:14 +0000 (13:12 +0200)]
git-gui: add a part about format strings in po/README

This should help tranlators that need to reorder words and strings.
Original explanation by Christian Stimming.

Also remove unneeded backslashes.

Signed-off-by: Michele Ballabio <barra_cuda@katamail.com>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
16 years agogit-gui: update po/it.po
Michele Ballabio [Wed, 21 May 2008 14:09:14 +0000 (16:09 +0200)]
git-gui: update po/it.po

Signed-off-by: Michele Ballabio <barra_cuda@katamail.com>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
16 years agogit-gui: update Japanese translation
しらいしななこ [Sun, 3 Aug 2008 08:01:50 +0000 (17:01 +0900)]
git-gui: update Japanese translation

This updates Japanese translation to match the updated git-gui.pot.

Signed-off-by: しらいしななこ <nanako3@lavabit.com>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
16 years agoadd --no-filters option to git hash-object
Dmitry Potapov [Sun, 3 Aug 2008 14:36:22 +0000 (18:36 +0400)]
add --no-filters option to git hash-object

The new option allows the contents to be hashed as is, ignoring any input
filter that would have been chosen by the attributes mechanism.

This option is incompatible with --path and --stdin-paths options.

Signed-off-by: Dmitry Potapov <dpotapov@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoadd --path option to git hash-object
Dmitry Potapov [Sun, 3 Aug 2008 14:36:21 +0000 (18:36 +0400)]
add --path option to git hash-object

The --path option allows us to pretend as if the contents being hashed
came from the specified path, and affects which input filter is used via
the attributes mechanism.  This is useful for hashing a temporary file
whose name is different from the path that is meant to have the hashed
contents.

Signed-off-by: Dmitry Potapov <dpotapov@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agouse parse_options() in git hash-object
Dmitry Potapov [Sun, 3 Aug 2008 14:36:20 +0000 (18:36 +0400)]
use parse_options() in git hash-object

Signed-off-by: Dmitry Potapov <dpotapov@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agocorrect usage help string for git-hash-object
Dmitry Potapov [Sun, 3 Aug 2008 14:36:19 +0000 (18:36 +0400)]
correct usage help string for git-hash-object

The usage string is corrected to make it fit in 80 columns and to make it
unequivocal about what options can be used with --stdin-paths.

Signed-off-by: Dmitry Potapov <dpotapov@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agocorrect argument checking test for git hash-object
Dmitry Potapov [Sun, 3 Aug 2008 14:36:18 +0000 (18:36 +0400)]
correct argument checking test for git hash-object

Because the file name given to stdin did not exist, git hash-object
fails to open it and exits with non-zero error code.

Thus the test may pass even if there is an error in argument checking.

Signed-off-by: Dmitry Potapov <dpotapov@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoteach index_fd to work with pipes
Dmitry Potapov [Sun, 3 Aug 2008 04:39:16 +0000 (08:39 +0400)]
teach index_fd to work with pipes

index_fd can now work with file descriptors that are not normal files
but any readable file. If the given file descriptor is a regular file
then mmap() is used; for other files, strbuf_read is used.

The path parameter, which has been used as hint for filters, can be
NULL now to indicate that the file should be hashed literally without
any filter.

The index_pipe function is removed as redundant.

Signed-off-by: Dmitry Potapov <dpotapov@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agogit-name-rev: don't use printf without format
René Scharfe [Sun, 3 Aug 2008 13:44:33 +0000 (15:44 +0200)]
git-name-rev: don't use printf without format

printf() without an explicit format string is not a good coding practise,
unless the printed string is guaranteed to not contain percent signs.  While
fixing this, we might as well combine the calls to fwrite() and printf().

Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agogitk: Updated German translation
Christian Stimming [Sat, 24 May 2008 20:42:30 +0000 (22:42 +0200)]
gitk: Updated German translation

This includes suggestions by Stephan Beyer.

Signed-off-by: Christian Stimming <stimming@tuhh.de>
Signed-off-by: Paul Mackerras <paulus@samba.org>
16 years agogit-gui: Update swedish translation.
Mikael Magnusson [Sat, 2 Aug 2008 23:46:23 +0000 (01:46 +0200)]
git-gui: Update swedish translation.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
16 years agodiff: chapter and part in funcname for tex
Giuseppe Bilotta [Sat, 2 Aug 2008 21:56:44 +0000 (23:56 +0200)]
diff: chapter and part in funcname for tex

This patch enhances the tex funcname by adding support for
chapter and part sectioning commands. It also matches
the starred version of the sectioning commands.

Signed-off-by: Giuseppe Bilotta <giuseppe.bilotta@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoTeach "git diff -p" Pascal/Delphi funcname pattern
Avery Pennarun [Fri, 1 Aug 2008 21:00:15 +0000 (17:00 -0400)]
Teach "git diff -p" Pascal/Delphi funcname pattern

Finds classes, records, functions, procedures, and sections.  Most lines
need to start at the first column, or else there's no way to differentiate
a procedure's definition from its declaration.

Signed-off-by: Avery Pennarun <apenwarr@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agodiff: add ruby funcname pattern
Giuseppe Bilotta [Thu, 31 Jul 2008 07:21:48 +0000 (09:21 +0200)]
diff: add ruby funcname pattern

Provide a regexp that catches class, module and method definitions in
Ruby scripts, since the built-in default only finds classes.

Signed-off-by: Giuseppe Bilotta <giuseppe.bilotta@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoFix reference to Everyday Git, which is an HTML document and not a man page.
Jon Jensen [Sat, 2 Aug 2008 21:41:48 +0000 (15:41 -0600)]
Fix reference to Everyday Git, which is an HTML document and not a man page.

Signed-off-by: Jon Jensen <jon@endpoint.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agobash completion: Add more long options for 'git log'
Lee Marlow [Sat, 2 Aug 2008 00:56:53 +0000 (18:56 -0600)]
bash completion: Add more long options for 'git log'

Options added: --parents --children --full-history

Signed-off-by: Lee Marlow <lee.marlow@gmail.com>
Acked-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agobash completion: remove unused function _git_diff_tree
Lee Marlow [Sat, 2 Aug 2008 04:47:09 +0000 (22:47 -0600)]
bash completion: remove unused function _git_diff_tree

completion for git diff-tree was removed in 5cfb4fe

Signed-off-by: Lee Marlow <lee.marlow@gmail.com>
Acked-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoclone: Add an option to set up a mirror
Johannes Schindelin [Sat, 2 Aug 2008 19:38:56 +0000 (21:38 +0200)]
clone: Add an option to set up a mirror

The command line

$ git clone --mirror $URL

is now a short-hand for

$ git clone --bare $URL
$ (cd $(basename $URL) && git remote add --mirror origin $URL)

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agogit-gui: Update git-gui.pot for 0.11 nearing release
Shawn O. Pearce [Sat, 2 Aug 2008 21:48:33 +0000 (14:48 -0700)]
git-gui: Update git-gui.pot for 0.11 nearing release

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
16 years agogit-gui: Update German translation
Christian Stimming [Sat, 2 Aug 2008 07:54:51 +0000 (09:54 +0200)]
git-gui: Update German translation

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
16 years agoMerge branch 'maint'
Junio C Hamano [Sat, 2 Aug 2008 18:58:34 +0000 (11:58 -0700)]
Merge branch 'maint'

* maint:
  git-name-rev: allow --name-only in combination with --stdin
  builtin-name-rev.c: split deeply nested part from the main function

Conflicts:
Documentation/git-name-rev.txt

16 years agogit-name-rev: allow --name-only in combination with --stdin
Pieter de Bie [Thu, 31 Jul 2008 13:20:34 +0000 (15:20 +0200)]
git-name-rev: allow --name-only in combination with --stdin

Signed-off-by: Pieter de Bie <pdebie@ai.rug.nl>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agobuiltin-name-rev.c: split deeply nested part from the main function
Junio C Hamano [Sat, 2 Aug 2008 18:04:22 +0000 (11:04 -0700)]
builtin-name-rev.c: split deeply nested part from the main function

The main function of this command implementation tries to do too many
things.  Split out a handling of single input line into a separate
function to reduce nesting level and clutter.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoMerge branch 'maint'
Junio C Hamano [Sat, 2 Aug 2008 06:55:51 +0000 (23:55 -0700)]
Merge branch 'maint'

16 years agoStart 1.5.6.5 RelNotes to describe accumulated fixes
Junio C Hamano [Sat, 2 Aug 2008 06:54:01 +0000 (23:54 -0700)]
Start 1.5.6.5 RelNotes to describe accumulated fixes

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 agoUpdate my e-mail address
Junio C Hamano [Mon, 21 Jul 2008 19:14:42 +0000 (12:14 -0700)]
Update my e-mail address

The old cox.net address is still getting mails from gitters.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agogit-diff(1): "--c" -> "--cc" typo fix
Jonathan Nieder [Mon, 21 Jul 2008 18:34:06 +0000 (13:34 -0500)]
git-diff(1): "--c" -> "--cc" typo fix

git diff does not take a --c option.

Signed-off-by: Jonathan Nieder <jrnieder@uchicago.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agogit-submodule: move ill placed shift.
Pierre Habouzit [Mon, 21 Jul 2008 18:15:59 +0000 (20:15 +0200)]
git-submodule: move ill placed shift.

When running git submodule update -i, the "-i" is shifted before recursing
into cmd_init and then again outside of the loop. This causes some /bin/sh
to complain about shifting when there are no arguments left (and would
discard anything written after -i too).

Signed-off-by: Pierre Habouzit <madcoder@debian.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agot/t4202-log.sh: add newline at end of file
Brandon Casey [Tue, 22 Jul 2008 21:23:31 +0000 (16:23 -0500)]
t/t4202-log.sh: add newline at end of file

Some shells hang when parsing the script if the last statement is not
followed by a newline. So add one.

Signed-off-by: Brandon Casey <casey@nrlssc.navy.mil>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agosort_in_topological_order(): avoid setting a commit flag
Johannes Schindelin [Wed, 23 Jul 2008 00:51:36 +0000 (01:51 +0100)]
sort_in_topological_order(): avoid setting a commit flag

We used to set the TOPOSORT flag of commits during the topological
sorting, but we can just as well use the member "indegree" for it:
indegree is now incremented by 1 in the cases where the commit used
to have the TOPOSORT flag.

This is the same behavior as before, since indegree could not be
non-zero when TOPOSORT was unset.

Incidentally, this fixes the bug in show-branch where the 8th column
was not shown: show-branch sorts the commits in topological order,
assuming that all the commit flags are available for show-branch's
private matters.

But this was not true: TOPOSORT was identical to the flag corresponding
to the 8th ref.  So the flags for the 8th column were unset by the
topological sorting.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoDocumentation: clarify diff --cc
Junio C Hamano [Wed, 23 Jul 2008 23:16:05 +0000 (16:16 -0700)]
Documentation: clarify diff --cc

The definition of an "uninteresting" hunk was not in line with reality.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoPropagate -u/--upload-pack option of "git clone" to transport.
Steve Haslam [Fri, 25 Jul 2008 17:51:51 +0000 (18:51 +0100)]
Propagate -u/--upload-pack option of "git clone" to transport.

The -u option to override the remote system's path to git-upload-pack was
being ignored by "git clone"; caused by a missing call to
transport_set_option to set TRANS_OPT_UPLOADPACK. Presumably this crept in
when git-clone was converted from shell to C.

Signed-off-by: Steve Haslam <shaslam@lastminute.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoDocumentation: fix diff.external example
Anders Melchiorsen [Sun, 27 Jul 2008 11:12:15 +0000 (13:12 +0200)]
Documentation: fix diff.external example

The diff.external examples pass a flag to gnu-diff, but GNU diff
does not follow the GIT_EXTERNAL_DIFF interface.

Signed-off-by: Anders Melchiorsen <mail@cup.kalibalik.dk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agomake sure parsed wildcard refspec ends with slash
Junio C Hamano [Sun, 27 Jul 2008 06:15:51 +0000 (23:15 -0700)]
make sure parsed wildcard refspec ends with slash

A wildcard refspec is internally parsed into a refspec structure with src
and dst strings.  Many parts of the code assumed that these do not include
the trailing "/*" when matching the wildcard pattern with an actual ref we
see at the remote.  What this meant was that we needed to make sure not
just that the prefix matched, and also that a slash followed the part that
matched.

But a codepath that scans the result from ls-remote and finds matching
refs forgot to check the "matching part must be followed by a slash" rule.
This resulted in "refs/heads/b1" from the remote side to mistakenly match
the source side of "refs/heads/b/*:refs/remotes/b/*" refspec.

Worse, the refspec crafted internally by "git-clone", and a hardcoded
preparsed refspec that is used to implement "git-fetch --tags", violated
this "parsed widcard refspec does not end with slash" rule; simply adding
the "matching part must be followed by a slash" rule then would have
broken codepaths that use these refspecs.

This commit changes the rule to require a trailing slash to parsed
wildcard refspecs.  IOW, "refs/heads/b/*:refs/remotes/b/*" is parsed as
src = "refs/heads/b/" and dst = "refs/remotes/b/".  This allows us to
simplify the matching logic because we only need to do a prefixcmp() to
notice "refs/heads/b/one" matches and "refs/heads/b1" does not.

Acked-by: Daniel Barkalow <barkalow@iabervon.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoinit: handle empty "template" parameter
Jeff King [Mon, 28 Jul 2008 06:02:04 +0000 (02:02 -0400)]
init: handle empty "template" parameter

If a user passes "--template=", then our template parameter
is blank. Unfortunately, copy_templates() assumes it has at
least one character, and does all sorts of bad things like
reading from template[-1] and then proceeding to link all of
'/' into the .git directory.

This patch just checks for that condition in copy_templates
and aborts. As a side effect, this means that --template=
now has the meaning "don't copy any templates."

Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agobuiltin-revert.c: typofix
Stephan Beyer [Sat, 2 Aug 2008 01:51:21 +0000 (03:51 +0200)]
builtin-revert.c: typofix

Signed-off-by: Stephan Beyer <s-beyer@gmx.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoAllow "non-option" revision options in parse_option-enabled commands
Pierre Habouzit [Thu, 31 Jul 2008 10:22:23 +0000 (12:22 +0200)]
Allow "non-option" revision options in parse_option-enabled commands

Commands which use parse_options() but also call setup_revisions()
must do their parsing in a two step process:

  1. first, they parse all options. Anything unknown goes to
     parse_revision_opt() (which calls handle_revision_opt), which
     may claim the option or say "I don't recognize this"

  2. the non-option remainder goes to setup_revisions() to
     actually get turned into revisions

Some revision options are "non-options" in that they must be
parsed in order with their revision counterparts in
setup_revisions().  For example, "--all" functions as a
pseudo-option expanding to all refs, and "--no-walk" affects refs
after it on the command line, but not before. The revision option
parser in step 1 recognizes such options and sets them aside for
later parsing by setup_revisions().

However, the return value used from handle_revision_opt indicated
"I didn't recognize this", which was wrong. It did, and it took
appropriate action (even though that action was just deferring it
for later parsing). Thus it should return "yes, I recognized
this."

Previously, these pseudo-options generated an error when used with
parse_options parsers (currently just blame and shortlog). With
this patch, they should work fine, enabling things like "git
shortlog --all".

Signed-off-by: Jeff King <peff@peff.net>
Acked-By: Pierre Habouzit <madcoder@debian.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoTeach --find-copies-harder to "git blame"
Junio C Hamano [Thu, 31 Jul 2008 07:05:22 +0000 (00:05 -0700)]
Teach --find-copies-harder to "git blame"

It's equivalent to "-C -C" with the diff family.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoCompact commit template message
Jeff King [Thu, 31 Jul 2008 07:36:09 +0000 (03:36 -0400)]
Compact commit template message

We recently let the user know explicitly that an empty
commit message will abort the commit. However, this adds yet
another line to the template; let's rephrase and re-wrap so
that this fits back on two lines.

This patch also makes the "fatal: empty commit message?"
warning a bit less scary, since this is now a "feature"
instead of an error. However, we retain the non-zero exit
status to indicate to callers that nothing was committed.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agogitk: Fallback to selecting the head commit upon load
Alexander Gavrilov [Sat, 26 Jul 2008 16:15:54 +0000 (20:15 +0400)]
gitk: Fallback to selecting the head commit upon load

Try selecting the head, if the previously selected commit
is not available in the new view.

Signed-off-by: Alexander Gavrilov <angavrilov@gmail.com>
Signed-off-by: Paul Mackerras <paulus@samba.org>
16 years agogitk: Fixed automatic row selection during load
Alexander Gavrilov [Sat, 26 Jul 2008 16:13:45 +0000 (20:13 +0400)]
gitk: Fixed automatic row selection during load

- Switching views now actually preserves the selected commit.
- Reloading (also Edit View) preserves the currently selected commit.
- Initial selection does not produce weird scrolling.

Signed-off-by: Alexander Gavrilov <angavrilov@gmail.com>
Signed-off-by: Paul Mackerras <paulus@samba.org>
16 years agogitk: Fixed broken exception handling in diff
Alexander Gavrilov [Sat, 26 Jul 2008 14:48:41 +0000 (18:48 +0400)]
gitk: Fixed broken exception handling in diff

If the tree diff command failed to start for some
random reason, treepending remained set, and thus
no more diffs were shown after that.

Signed-off-by: Alexander Gavrilov <angavrilov@gmail.com>
Signed-off-by: Paul Mackerras <paulus@samba.org>
16 years agogitk: On Windows, use a Cygwin-specific flag for kill
Alexander Gavrilov [Mon, 14 Jul 2008 20:35:42 +0000 (00:35 +0400)]
gitk: On Windows, use a Cygwin-specific flag for kill

MSysGit compiles git binaries as native Windows executables,
so they cannot be killed unless a special flag is specified.

This flag is implemented by the Cygwin version of kill,
which is also included in MSysGit.

Signed-off-by: Alexander Gavrilov <angavrilov@gmail.com>
Signed-off-by: Paul Mackerras <paulus@samba.org>
16 years agogitk: Arrange to kill diff-files & diff-index on quit
Alexander Gavrilov [Sun, 13 Jul 2008 12:40:47 +0000 (16:40 +0400)]
gitk: Arrange to kill diff-files & diff-index on quit

Local change analysis can take a noticeable amount of time on large
file sets, and produce no output if there are no changes.  Register
the back-ends in commfd, so that they get properly killed on window
close.

Signed-off-by: Alexander Gavrilov <angavrilov@gmail.com>
Signed-off-by: Paul Mackerras <paulus@samba.org>
16 years agogitk: Kill back-end processes on window close
Alexander Gavrilov [Sat, 12 Jul 2008 12:09:28 +0000 (16:09 +0400)]
gitk: Kill back-end processes on window close

When collecting commits for a rarely changed, or recently
created file or directory, rev-list may work for a noticeable
period of time without producing any output.  Such processes
don't receive SIGPIPE for a while after gitk is closed, thus
becoming runaway CPU hogs.

Signed-off-by: Alexander Gavrilov <angavrilov@gmail.com>
Signed-off-by: Paul Mackerras <paulus@samba.org>
16 years agoMake the DESCRIPTION match <x>... items in the SYNOPSIS
Abhijit Menon-Sen [Wed, 30 Jul 2008 09:33:43 +0000 (15:03 +0530)]
Make the DESCRIPTION match <x>... items in the SYNOPSIS

When the SYNOPSIS says e.g. "<path>...", it is nice if the DESCRIPTION
also mentions "<path>..." and says the specified "paths" (note plural)
are used for $whatever. This fixes the obvious mismatches.

Signed-off-by: Abhijit Menon-Sen <ams@toroid.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agodocumentation: user-manual: update "using-bisect" section
Christian Couder [Thu, 31 Jul 2008 03:22:40 +0000 (05:22 +0200)]
documentation: user-manual: update "using-bisect" section

Since version 1.5.6 "git bisect" doesn't use a "bisect" branch any
more, but the user manual had not been updated to reflect this.

So this patch does that and while at it also adds a few words about
"git bisect skip" and points user to the "git bisect" man page for
more information.

Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoFix test-parse-options "integer" test
Junio C Hamano [Wed, 30 Jul 2008 19:53:45 +0000 (12:53 -0700)]
Fix test-parse-options "integer" test

OPT_INTEGER() works on an integer, not on an unsigned long.  On a big
endian architecture with long larger than int, integer test gives bogus
results because of this bug.

Reported by H.Merijn Brand in HP-UX 64-bit environment.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoReplace uses of "git-var" with "git var"
Todd Zullinger [Wed, 30 Jul 2008 17:48:33 +0000 (13:48 -0400)]
Replace uses of "git-var" with "git var"

Signed-off-by: Todd Zullinger <tmz@pobox.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoFix merge name generation in "merge in C"
Junio C Hamano [Wed, 30 Jul 2008 08:12:19 +0000 (01:12 -0700)]
Fix merge name generation in "merge in C"

When merging an early part of a branch, e.g. "git merge xyzzy~20", we were
supposed to say "branch 'xyzzy' (early part)", but it incorrectly said
"branch 'refs/heads/xy' (early part)" instead.

The logic was supposed to first strip away "~20" part to make sure that
what follows "~" is a non-zero posint, prefix it with "refs/heads/" and
ask resolve_ref() if it is a ref.  If it is, then we know xyzzy was a
branch, and we can give the correct message.

However, there were a few bugs.  First of all, the logic to build this
"true branch refname" did not count the characters correctly.  At this
point of the code, "len" is the number of trailing, non-name part of the
given extended SHA-1 expression given by the user, i.e. number of bytes in
"~20" in the above example.

In addition, the message forgot to skip "refs/heads/" it prefixed from the
output.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agogit-merge-octopus: use (merge-base A (merge B C D E...)) for stepwise merge
Junio C Hamano [Sun, 27 Jul 2008 20:47:22 +0000 (13:47 -0700)]
git-merge-octopus: use (merge-base A (merge B C D E...)) for stepwise merge

Suppose you have this topology, and you are trying to make an octopus
across A, B and C (you are at C and merging A and B into your branch).
The protoccol between "git merge" and merge strategies is for the former
to pass common ancestor(s), '--' and then commits being merged.

git-merge-octopus does not produce the final merge in one-go.  It
iteratively produces pairwise merges.  So the first step might be to come
up with a merge between B and C:

               o---o---o---o---C
              /                 :
             /   o---o---o---B..(M)
            /   /
        ---1---2---o---o---o---A

and for that, "1" is used as the merge base, not because it is the base
across A, B and C but because it is the base between B and C.  For this
merge, A does not matter.

I drew M in parentheses and lines between B and C to it in dotted line
because we actually do _not_ create a real commit --- the only thing we
need is a tree object, in order to proceed to the next step.

Then the final merge result is obtained by merging tree of (M) and A using
their common ancestor.  For that, we _could_ still use "1" as the merge
base.

But if you imagine a case where you started from A and M, you would _not_
pick "1" as the merge base; you would rather use "2" which is a better
base for this merge.

That is why git-merge-octopus ignores the merge base given by "merge" but
computes its own.

The comment at the end of git-merge-octopus talks about "merge reference
commit", that we used to update it to common found in this round, and that
that updating was pointless.  After the first round of merge to produce
the tree for M (but without actually creating the commit object M itself),
in order to figure out the merge base used to merge that with A in the
second round, we used to use A and "1" (which was merge base between B and
C).  That was pointless --- "merge-base A 1" is guaranteed to give a base
that is no better than either "merge-base A B" or "merge-base A C".  So
the current code keeps using the original head (iow, MRC=C, because in
this case we are starting from C and merging B and then A into it).

This trickerly was necessary only because we avoided creating the extra
merge commit object M.

Side note.  An alternative implementation could have been to
actually record it as a real merge commit M, and then let the
two-commit merge-base compute the base between A and M when
merging A to the result of the previous round, but we avoided
creating M, at the expense of potentially using suboptimal base in
the later rounds.

But we do not have to be that pessimistic.  We can instead accumulate the
commits we have merged so far in MRC, and have merge_bases_many() compute
the merge base for the new head being merged and the heads we have
processed so far, which can give a better base than what we currently do.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoDocumentation/git-rev-parse.txt: update for new git-describe output format
Cesar Eduardo Barros [Sun, 27 Jul 2008 00:46:00 +0000 (21:46 -0300)]
Documentation/git-rev-parse.txt: update for new git-describe output format

Signed-off-by: Cesar Eduardo Barros <cesarb@cesarb.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoMerge git://repo.or.cz/git-gui
Junio C Hamano [Wed, 30 Jul 2008 07:18:26 +0000 (00:18 -0700)]
Merge git://repo.or.cz/git-gui

* git://repo.or.cz/git-gui:
  git-gui (Windows): Change wrapper to execdir 'libexec/git-core'
  git-gui (Windows): Switch to relative discovery of oguilib
  git-gui: Correct installation of library to be $prefix/share
  git-gui: Fix gitk search in $PATH to work on Windows
  git-gui: Preserve scroll position on reshow_diff.
  git-gui: Fix the Remote menu separator.

16 years agoarchive: allow --exec and --remote without equal sign
Rene Scharfe [Fri, 25 Jul 2008 10:41:26 +0000 (12:41 +0200)]
archive: allow --exec and --remote without equal sign

Convert git archive to parse_options().  The parameters --remote and --exec
are still handled by their special parser.  Define them anyway in order for
them to show up in the usage notice.

Note: in a command like "git archive --prefix --remote=a/ HEAD", the string
"--remote=a/" will be interpreted as a remote option, not a prefix, because
that special parser sees it first.  If one needs such a strange prefix, it
needs to be specified like this: "git archive --prefix=--remote=a/ HEAD"
(with an equal sign).

Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoTeach gitlinks to ie_modified() and ce_modified_check_fs()
Junio C Hamano [Tue, 29 Jul 2008 08:13:44 +0000 (01:13 -0700)]
Teach gitlinks to ie_modified() and ce_modified_check_fs()

The ie_modified() function is the workhorse for refresh_cache_entry(),
i.e. checking if an index entry that is stat-dirty actually has changes.

After running quicker check to compare cached stat information with
results from the latest lstat(2) to answer "has modification" early, the
code goes on to check if there really is a change by comparing the staged
data with what is on the filesystem by asking ce_modified_check_fs().
However, this function always said "no change" for any gitlinks that has a
directory at the corresponding path.  This made ie_modified() to miss
actual changes in the subproject.

The patch fixes this first by modifying an existing short-circuit logic
before calling the ce_modified_check_fs() function.  It knows that for any
filesystem entity to which ie_match_stat() says its data has changed, if
its cached size is nonzero then the contents cannot match, which is a
correct optimization only for blob objects.  We teach gitlink objects to
this special case, as we already know that any gitlink that
ie_match_stat() says is modified is indeed modified at this point in the
codepath.

With the above change, we could leave ce_modified_check_fs() broken, but
it also futureproofs the code by teaching it to use ce_compare_gitlink(),
instead of assuming (incorrectly) that any directory is unchanged.

Originally noticed by Alex Riesen on Cygwin.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoAdvertise the ability to abort a commit
Anders Melchiorsen [Tue, 29 Jul 2008 20:12:22 +0000 (22:12 +0200)]
Advertise the ability to abort a commit

This treats aborting a commit more like a feature.

Signed-off-by: Anders Melchiorsen <mail@cup.kalibalik.dk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoSupport copy and rename detection in fast-export.
Alexander Gavrilov [Sat, 26 Jul 2008 20:52:54 +0000 (00:52 +0400)]
Support copy and rename detection in fast-export.

Although it does not matter for Git itself, tools that
export to systems that explicitly track copies and
renames can benefit from such information.

This patch makes fast-export output correct action
logs when -M or -C are enabled.

Signed-off-by: Alexander Gavrilov <angavrilov@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agomerge-base-many: add trivial tests based on the documentation
Junio C Hamano [Wed, 30 Jul 2008 06:51:41 +0000 (23:51 -0700)]
merge-base-many: add trivial tests based on the documentation

Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoformat-patch: Produce better output with --inline or --attach
Kevin Ballard [Wed, 30 Jul 2008 05:49:33 +0000 (22:49 -0700)]
format-patch: Produce better output with --inline or --attach

This patch makes two small changes to improve the output of --inline
and --attach.

The first is to write a newline preceding the boundary. This is needed because
MIME defines the encapsulation boundary as including the preceding CRLF (or in
this case, just LF), so we should be writing one. Without this, the last
newline in the pre-diff content is consumed instead.

The second change is to always write the line termination character
(default: newline) even when using --inline or --attach. This is simply to
improve the aesthetics of the resulting message. When using --inline an email
client should render the resulting message identically to the non-inline
version. And when using --attach this adds a blank line preceding the
attachment in the email, which is visually attractive.

Signed-off-by: Kevin Ballard <kevin@sb.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoDocumentation: Remove mentions of git-svnimport.
Brian Gernhardt [Wed, 30 Jul 2008 01:16:01 +0000 (21:16 -0400)]
Documentation: Remove mentions of git-svnimport.

git-svnimport is no longer supported, so don't mention it in the
documentation.  This also updates the description, removing the
historical discussion, since it mostly dealt with how it differed from
svnimport.  The new description gives some starting points into the
rest of the documentation.

Noticed by Jurko Gospodnetić <jurko.gospodnetic@docte.hr>

Signed-off-by: Brian Gernhardt <benji@silverinsanity.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoMake it clear that push can take multiple refspecs
Abhijit Menon-Sen [Tue, 29 Jul 2008 23:13:38 +0000 (04:43 +0530)]
Make it clear that push can take multiple refspecs

Signed-off-by: Abhijit Menon-Sen <ams@toroid.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years ago`git submodule add` now requires a <path>
Abhijit Menon-Sen [Tue, 29 Jul 2008 19:53:16 +0000 (01:23 +0530)]
`git submodule add` now requires a <path>

Signed-off-by: Abhijit Menon-Sen <ams@toroid.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agodocumentation: merge-base: explain "git merge-base" with more than 2 args
Junio C Hamano [Wed, 30 Jul 2008 05:04:43 +0000 (07:04 +0200)]
documentation: merge-base: explain "git merge-base" with more than 2 args

Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agomerge-base: teach "git merge-base" to drive underlying merge_bases_many()
Christian Couder [Wed, 30 Jul 2008 05:04:14 +0000 (07:04 +0200)]
merge-base: teach "git merge-base" to drive underlying merge_bases_many()

Even though the underlying function for get_merge_bases() can compute
a merge base between one existing commit and another (possibly
nonexistent) commit that would be created by merging many commits,
the facility was not available to git-merge-base.

Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agogit-gui (Windows): Change wrapper to execdir 'libexec/git-core'
Steffen Prohaska [Sun, 27 Jul 2008 16:49:43 +0000 (18:49 +0200)]
git-gui (Windows): Change wrapper to execdir 'libexec/git-core'

git-gui needs bindir in PATH to be able to run 'git'.  bindir
however is not necessarily in PATH if started directly through a
Windows shortcut.  Therefore, we used to add the directory
git-gui is located in.  But with the new 'libexec/git-core'
layout this directory is no longer identical to bindir.

This commit modifies the wrapper script to discover the bindir
and add it to PATH.

Signed-off-by: Steffen Prohaska <prohaska@zib.de>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
16 years agogit-gui (Windows): Switch to relative discovery of oguilib
Steffen Prohaska [Sun, 27 Jul 2008 16:49:42 +0000 (18:49 +0200)]
git-gui (Windows): Switch to relative discovery of oguilib

Instead of using an absolute path, git-gui can discover its
gui library using a relative path from execdir.  We want to
use the relative path discovery on MinGW to avoid issues
with translation of absolute paths.

Signed-off-by: Steffen Prohaska <prohaska@zib.de>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
16 years agogit-gui: Correct installation of library to be $prefix/share
Steffen Prohaska [Sun, 27 Jul 2008 21:23:30 +0000 (14:23 -0700)]
git-gui: Correct installation of library to be $prefix/share

We always wanted the library for git-gui to install into the
$prefix/share directory, not $prefix/libexec/share.  All of
the files in our library are platform independent and may
be reused across systems, like any other content stored in
the share directory.

Our computation of where our library should install to was broken
when git itself started installing to $prefix/libexec/git-core,
which was one level down from where we expected it to be.

Signed-off-by: Steffen Prohaska <prohaska@zib.de>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
16 years agogit-gui: Fix gitk search in $PATH to work on Windows
Shawn O. Pearce [Wed, 30 Jul 2008 05:36:58 +0000 (22:36 -0700)]
git-gui: Fix gitk search in $PATH to work on Windows

Back in 15430be5a1 ("Look for gitk in $PATH, not $LIBEXEC/git-core")
git-gui learned to use [_which gitk] to locate where gitk's script
is as Git 1.6 will install gitk to $prefix/bin (in $PATH) and all
of the other tools are in $gitexecdir.

This failed on Windows because _which adds the ".exe" suffix as it
searches for the program on $PATH, under the assumption that we can
only execute something from Tcl if it is a proper Windows executable.

When scanning for gitk on Windows we need to omit the ".exe" suffix.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
16 years agoMake use of stat.ctime configurable
Alex Riesen [Mon, 28 Jul 2008 06:31:28 +0000 (08:31 +0200)]
Make use of stat.ctime configurable

A new configuration variable 'core.trustctime' is introduced to
allow ignoring st_ctime information when checking if paths
in the working tree has changed, because there are situations where
it produces too much false positives.  Like when file system crawlers
keep changing it when scanning and using the ctime for marking scanned
files.

The default is to notice ctime changes.

Signed-off-by: Alex Riesen <raa.lkml@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agomerge-base: die with an error message if not passed a commit ref
Christian Couder [Tue, 29 Jul 2008 05:42:53 +0000 (07:42 +0200)]
merge-base: die with an error message if not passed a commit ref

Before this patch "git merge-base" just exited with error code 1
and without an error message in case it was passed a ref to an
object that is not a commit (for example a tree).

This patch makes it "die" in this case with an error message.

While at it, this patch also refactors the code to get the
commit reference from an argument into a new
"get_commit_reference" function.

Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agot7001: fix "git mv" test
Junio C Hamano [Tue, 29 Jul 2008 05:27:39 +0000 (22:27 -0700)]
t7001: fix "git mv" test

The test assumed that we can keep the cached stat information fresh across
rename(2); many filesystems however update st_ctime (and POSIX allows them
to do so), and that assumption does not hold.

We can explicitly refresh the index for the purpose of these tests.  The
only thing we are interested in is the staged contents and the mode bits
are preserved across "git mv".

Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoDocumentation: clarify what is shown in "git-ls-files -s" output
Junio C Hamano [Tue, 29 Jul 2008 05:26:47 +0000 (22:26 -0700)]
Documentation: clarify what is shown in "git-ls-files -s" output

Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agorun-command (Windows): Run dashless "git <cmd>"
Steffen Prohaska [Mon, 28 Jul 2008 05:50:28 +0000 (07:50 +0200)]
run-command (Windows): Run dashless "git <cmd>"

We prefer running the dashless form, and POSIX side already does so; we
should use it in MinGW's start_command(), too.

Signed-off-by: Steffen Prohaska <prohaska@zib.de>
Acked-by: Johannes Sixt <johannes.sixt@telecom.at>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoRefactor, adding prepare_git_cmd(const char **argv)
Steffen Prohaska [Mon, 28 Jul 2008 05:50:27 +0000 (07:50 +0200)]
Refactor, adding prepare_git_cmd(const char **argv)

prepare_git_cmd(const char **argv) adds a first entry "git" to
the array argv.  The new array is allocated on the heap.  It's
the caller's responsibility to release it with free().  The code
was already present in execv_git_cmd() but could not be used from
outside.  Now it can also be called for preparing the command list
in the MinGW codepath in run-command.c.

Signed-off-by: Steffen Prohaska <prohaska@zib.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agobuiltin-verify-tag: fix -v option parsing
Olivier Marin [Mon, 28 Jul 2008 10:48:44 +0000 (12:48 +0200)]
builtin-verify-tag: fix -v option parsing

Since the C rewrite, "git verify-tag -v" just does nothing instead of
printing the usage message with an error. This patch fix the regression.

Signed-off-by: Olivier Marin <dkr@freesurf.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agols-tree documentation: enhance notes on subdirectory and pathspec behaviour
Junio C Hamano [Mon, 28 Jul 2008 09:33:33 +0000 (02:33 -0700)]
ls-tree documentation: enhance notes on subdirectory and pathspec behaviour

When run in a working copy subdirectory, git-ls-tree will automagically
add the prefix to the pathspec, which can result in an unexpected behavior
when the tree object accessed is not the root tree object.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoAllow installing in the traditional way
Junio C Hamano [Mon, 28 Jul 2008 07:05:10 +0000 (00:05 -0700)]
Allow installing in the traditional way

In an earlier commit c70a8d9 (Makefile: Do not install a copy of 'git' in
$(gitexecdir), 2008-07-21), we tried to avoid installing two git, one in
/usr/bin/git and the other in /usr/libexec/git-core/git.  It mistakenly
removed the only copy of git when gitexecdir and bindir are set to the
same directory, i.e. the traditional layout.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoAllow building without any git installed
Junio C Hamano [Mon, 28 Jul 2008 07:02:48 +0000 (00:02 -0700)]
Allow building without any git installed

This is a follow-up patch to 49fa65a (Allow the built-in exec path to be
relative to the command invocation path, 2008-07-23).  Without specific
gitexecdir passed from the command line, git-gui's build procedure would
try to figure out the value for it by running an installed git.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoinit: handle empty "template" parameter
Jeff King [Mon, 28 Jul 2008 06:02:04 +0000 (02:02 -0400)]
init: handle empty "template" parameter

If a user passes "--template=", then our template parameter
is blank. Unfortunately, copy_templates() assumes it has at
least one character, and does all sorts of bad things like
reading from template[-1] and then proceeding to link all of
'/' into the .git directory.

This patch just checks for that condition in copy_templates
and aborts. As a side effect, this means that --template=
now has the meaning "don't copy any templates."

Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoGIT 1.6.0-rc1 v1.6.0-rc1
Junio C Hamano [Sun, 27 Jul 2008 19:37:51 +0000 (12:37 -0700)]
GIT 1.6.0-rc1

Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agogit-mv: Keep moved index entries inact
Petr Baudis [Mon, 21 Jul 2008 00:25:56 +0000 (02:25 +0200)]
git-mv: Keep moved index entries inact

The rewrite of git-mv from a shell script to a builtin was perhaps
a little too straightforward: the git add and git rm queues were
emulated directly, which resulted in a rather complicated code and
caused an inconsistent behaviour when moving dirty index entries;
git mv would update the entry based on working tree state,
except in case of overwrites, where the new entry would still have
sha1 of the old file.

This patch introduces rename_index_entry_at() into the index toolkit,
which will rename an entry while removing any entries the new entry
might render duplicate. This is then used in git mv instead
of all the file queues, resulting in a major simplification
of the code and an inevitable change in git mv -n output format.

Also the code used to refuse renaming overwriting symlink with a regular
file and vice versa; there is no need for that.

A few new tests have been added to the testsuite to reflect this change.

Signed-off-by: Petr Baudis <pasky@suse.cz>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agogit-mv: Remove dead code branch
Petr Baudis [Wed, 16 Jul 2008 19:11:08 +0000 (21:11 +0200)]
git-mv: Remove dead code branch

The path list builder had a branch for the case the source is not in index, but
this can happen only if the source was a directory. However, in that case we
have already expanded the list to the directory contents and set mode
to WORKING_DIRECTORY, which is tested earlier.

The patch removes the superfluous branch and adds an assert() instead. git-mv
testsuite still passes.

Signed-off-by: Petr Baudis <pasky@suse.cz>
Signed-off-by: Junio C Hamano <gitster@pobox.com>