Code

git.git
15 years agoMerge branch 'maint'
Junio C Hamano [Sat, 2 Aug 2008 06:55:51 +0000 (23:55 -0700)]
Merge branch 'maint'

15 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>
15 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>
15 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>
15 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>
15 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>
15 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>
15 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>
15 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>
15 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>
15 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>
15 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>
15 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>
15 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>
15 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>
15 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>
15 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>
15 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>
15 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>
15 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>
15 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>
15 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>
15 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>
15 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.

15 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>
15 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>
15 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>
15 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>
15 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>
15 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>
15 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>
15 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>
15 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>
15 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>
15 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>
15 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>
15 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>
15 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>
15 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>
15 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>
15 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>
15 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>
15 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>
15 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>
15 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>
15 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>
15 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>
15 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>
15 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>
15 years agofsck: Don't require tmp_obj_ file names are 14 bytes in length
Shawn O. Pearce [Sun, 27 Jul 2008 02:33:00 +0000 (21:33 -0500)]
fsck: Don't require tmp_obj_ file names are 14 bytes in length

Not all temporary file creation routines will ensure 14 bytes are
used to generate the temporary file name.  In C Git this may be
true, but alternate implementations such as jgit are not always
able to generate a temporary file name with a specific prefix and
also ensure the file name length is 14 bytes long.

Since temporary files in a directory we are fsck'ing should be
uncommon (as they are short lived only long enough for an active
writer to finish writing the file and rename it) we shouldn't see
these show up very often.  Always using a prefixcmp() call and
ignoring the length opens up room for other implementations to use
different name generation schemes.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoAvoid chdir() in list_commands_in_dir()
Johannes Schindelin [Sun, 27 Jul 2008 20:34:14 +0000 (22:34 +0200)]
Avoid chdir() in list_commands_in_dir()

The function list_commands_in_dir() tried to be lazy and just chdir()
to the directory which entries it listed, so that the check if the
file is executable could be done on dir->d_name.

However, there is no good reason to jump around wildly just to find
all Git commands.

Instead, have a strbuf and construct the full path dynamically.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agobuiltin-branch: fix -v for --[no-]merged
Lars Hjemli [Sat, 26 Jul 2008 10:27:25 +0000 (12:27 +0200)]
builtin-branch: fix -v for --[no-]merged

After the optimization to --[no-]merged logic, the calculation of the
width of the longest refname to be shown might become inaccurate (since
the matching against merge_filter is performed after adding refs to
ref_list). This patch forces a recalculation of maxwidth when it might
be needed.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agobuiltin-branch: factor out merge_filter matching
Lars Hjemli [Sat, 26 Jul 2008 10:27:24 +0000 (12:27 +0200)]
builtin-branch: factor out merge_filter matching

The logic for checking commits against merge_filter will be reused
when we recalculate the maxwidth of refnames.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agobuiltin-branch: remove duplicated code
Lars Hjemli [Sat, 26 Jul 2008 10:27:23 +0000 (12:27 +0200)]
builtin-branch: remove duplicated code

The previous optimization to --[no-]merged ended up with some duplicated
code which this patch removes.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agorev-parse: Add support for the ^! and ^@ syntax
Björn Steinbrink [Sat, 26 Jul 2008 16:37:56 +0000 (18:37 +0200)]
rev-parse: Add support for the ^! and ^@ syntax

Those shorthands are explained in the rev-parse documentation but were not
actually supported by rev-parse itself.

gitk internally uses rev-parse to interpret its command line arguments, and
being able to use these "limit with parents" syntax is handy there.

Signed-off-by: Björn Steinbrink <B.Steinbrink@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 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>
15 years agogitweb: More about how gitweb gets 'owner' of repository
Jakub Narebski [Sat, 26 Jul 2008 23:23:46 +0000 (01:23 +0200)]
gitweb: More about how gitweb gets 'owner' of repository

Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Acked-by: Petr Baudis <pasky@suse.cz>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agot6030 (bisect): work around Mac OS X "ls"
Jonathan Nieder [Sun, 27 Jul 2008 04:53:30 +0000 (23:53 -0500)]
t6030 (bisect): work around Mac OS X "ls"

t6030-bisect-porcelain.sh relies on "ls" exiting with nonzero
status when asked to list nonexistent files.  Unfortunately,
/bin/ls on Mac OS X 10.3 exits with exit code 0.  So look at
its output instead.

Signed-off-by: Jonathan Nieder <jrnieder@uchicago.edu>
Acked-by: Christian Couder <chriscool@tuxfamily.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoDocumentation/git-submodule.txt: fix doubled word
Cesar Eduardo Barros [Sat, 26 Jul 2008 04:17:42 +0000 (01:17 -0300)]
Documentation/git-submodule.txt: fix doubled word

Signed-off-by: Cesar Eduardo Barros <cesarb@cesarb.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agobash completion: Add completion for 'git help'
Lee Marlow [Thu, 24 Jul 2008 00:07:23 +0000 (18:07 -0600)]
bash completion: Add completion for 'git help'

Rename cached __git_commandlist to __git_porcelain_commandlist and
add __git_all_commandlist that only filters out *--* helpers.

Completions for 'git help' will use the __git_all_commandlist, while
the __git_porcelain_commandlist is used for git command completion.

Users who actually read man pages may want to see help for plumbing
commands.

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>
15 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>
15 years agobash completion: Add long options for 'git describe'
Thomas Rast [Sat, 26 Jul 2008 10:26:56 +0000 (12:26 +0200)]
bash completion: Add long options for 'git describe'

Signed-off-by: Thomas Rast <trast@student.ethz.ch>
Acked-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoClarify that "git log x.c y.h" lists commits that touch either file
Abhijit Menon-Sen [Sat, 26 Jul 2008 16:50:35 +0000 (22:20 +0530)]
Clarify that "git log x.c y.h" lists commits that touch either file

Signed-off-by: Abhijit Menon-Sen <ams@toroid.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoMerge git://repo.or.cz/git-gui
Junio C Hamano [Sun, 27 Jul 2008 21:09:25 +0000 (14:09 -0700)]
Merge git://repo.or.cz/git-gui

* git://repo.or.cz/git-gui:
  git-gui: "Stage Line": Treat independent changes in adjacent lines better
  git-gui: Fix "Stage/Unstage Line" with one line of context.
  git-gui: Correct 'Visualize Branches' on Mac OS X to start gitk
  git-gui: Look for gitk in $PATH, not $LIBEXEC/git-core
  Add a menu item to invoke full copy detection in blame.
  Kill the blame back-end on window close.
  Add options to control the search for copies in blame.
  Fix pre-commit hooks under MinGW/MSYS

15 years agogit-gui: Preserve scroll position on reshow_diff.
Alexander Gavrilov [Sun, 27 Jul 2008 06:35:38 +0000 (10:35 +0400)]
git-gui: Preserve scroll position on reshow_diff.

It is especially useful for Stage/Unstage Line, because
they invoke full state scan and diff reload, which originally
would reset the scroll position to the top of the file.

Signed-off-by: Alexander Gavrilov <angavrilov@gmail.com>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
15 years agogit-gui: Fix the Remote menu separator.
Alexander Gavrilov [Sun, 27 Jul 2008 06:34:21 +0000 (10:34 +0400)]
git-gui: Fix the Remote menu separator.

It was positioned incorrectly (offset by one position)
if the menu had a tear-off handle.

Signed-off-by: Alexander Gavrilov <angavrilov@gmail.com>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
15 years agogit-gui: "Stage Line": Treat independent changes in adjacent lines better
Johannes Sixt [Thu, 17 Jul 2008 13:21:51 +0000 (15:21 +0200)]
git-gui: "Stage Line": Treat independent changes in adjacent lines better

Assume that we want to commit these states:

  Old state == HEAD    Intermediate state   New state
  --------------------------------------------------------
  context before       context before       context before
  old 1                new 1                new 1
  old 2                old 2                new 2
  context after        context after        context after

that is, want to commit two changes in this order:

  1. transform "old 1" into "new 1"
  2. transform "old 2" into "new 2"

[This discussion and this patch is about this very case and one other case
as outlined below; any other intermediate states that one could imagine are
not affected by this patch.]

Now assume further, that we have not staged and commited anything, but we
have already changed the working file to the new state. Then we will see
this hunk in the "Unstaged Changes":

  @@ -1,4 +1,4 @@
   context before
  -old 1
  -old 2
  +new 1
  +new 2
   context after

The obvious way to stage the intermediate state is to apply "Stage This
Line" to "-old 1" and "+new 1". Unfortunately, this resulted in this
intermediate state:

  context before
  old 2
  new 1
  context after

which is not what we wanted. In fact, it was impossible to stage the
intermediate state using "Stage Line". The crux was that if a "+" line was
staged, then the "-" lines were converted to context lines and arranged
*before* the "+" line in the forged hunk that we fed to 'git apply'.

With this patch we now treat "+" lines that are staged differently. In
particular, the "-" lines before the "+" block are moved *after* the
staged "+" line. Now it is possible to get the correct intermediate state
by staging "-old 1" and "+new 1". Problem solved.

But there is a catch.

Noticing that we didn't get the right intermediate state by staging
"-old 1" and "+new 1", we could have had the idea to stage the complete
hunk and to *unstage* "-old 2" and "+new 2". But... the result is the same.
The reason is that there is the exact symmetric problem with unstaging the
last "-" and "+" line that are in adjacent blocks of "-" and "+" lines.

This patch does *not* change the way in which "-" lines are *unstaged*.

Why? Because if we did (i.e. move "+" lines before the "-" line after
converting them to context lines), then it would be impossible to stage
this intermediate state:

  context before
  old 1
  new 2
  context after

that is, it would be impossible to stage the two independet changes in the
opposite order.

Let's look at this case a bit further: The obvious way to get this
intermediate state would be to apply "Stage This Line" to "-old 2" and
"+new 2". Before this patch, this worked as expected. With this patch, it
does not work as expected, but it can still be achieved by first staging
the entire hunk, then *unstaging* "-old 1" and "+new 1".

In summary, this patch makes a common case possible, at the expense that
a less common case is made more complicated for the user.

Signed-off-by: Johannes Sixt <johannes.sixt@telecom.at>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
15 years agogit-gui: Fix "Stage/Unstage Line" with one line of context.
Johannes Sixt [Tue, 15 Jul 2008 21:11:00 +0000 (23:11 +0200)]
git-gui: Fix "Stage/Unstage Line" with one line of context.

To "Stage/Unstage Line" we construct a patch that contains exactly one
change (either addition or removal); the hunk header was forged by counting
the old side and adjusting the count by +/-1 for the new side. But when we
counted the context we never counted the changed line itself. If the hunk
had only one removal line and one line of context, like this:

    @@ -1,3 +1,2 @@
     context 1
    -removal
     context 2

We had constructed this patch:

    @@ -1,2 +1,1 @@
     context 1
    -removal
     context 2

which does not apply because git apply deduces that it must apply at the
end of the file. ("context 2" is considered garbage and ignored.) The fix
is that removal lines must be counted towards the context of the old side.

Signed-off-by: Johannes Sixt <johannes.sixt@telecom.at>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
15 years agogit-reset: Let -q hush "locally modified" messages
Stephan Beyer [Fri, 25 Jul 2008 20:49:08 +0000 (22:49 +0200)]
git-reset: Let -q hush "locally modified" messages

"git reset -q" is advertised to "only report errors", but "locally
modified" messages are still shown.  They are not errors but diagnostics.

Signed-off-by: Stephan Beyer <s-beyer@gmx.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agogit-svn: teach dcommit about svn auto-props
Brad King [Fri, 25 Jul 2008 15:32:37 +0000 (11:32 -0400)]
git-svn: teach dcommit about svn auto-props

Subversion repositories often require files to have properties such as
svn:mime-type and svn:eol-style set when they are added.  Users
typically set these properties automatically using the SVN auto-props
feature with 'svn add'.  This commit teaches dcommit to look at the user
SVN configuration and apply matching auto-props entries for files added
by a diff as it is applied to the SVN remote.

Signed-off-by: Brad King <brad.king@kitware.com>
Acked-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoWindows: Do not compile git-shell
Johannes Sixt [Mon, 21 Jul 2008 19:19:58 +0000 (21:19 +0200)]
Windows: Do not compile git-shell

Signed-off-by: Johannes Sixt <johannes.sixt@telecom.at>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoWindows: Make sure argv[0] has a path
Johannes Sixt [Mon, 21 Jul 2008 19:19:57 +0000 (21:19 +0200)]
Windows: Make sure argv[0] has a path

Since the exec-path on Windows is derived from the program invocation path,
we must ensure that argv[0] always has a path. Unfortunately, if a program
is invoked from CMD, argv[0] has no path. But on the other hand, the
C runtime offers a global variable, _pgmptr, that always has the full path
to the program. We hook into main() with a preprocessor macro, where we
replace argv[0].

Signed-off-by: Johannes Sixt <johannes.sixt@telecom.at>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoWindows: Make $(gitexecdir) relative
Johannes Sixt [Mon, 21 Jul 2008 19:19:56 +0000 (21:19 +0200)]
Windows: Make $(gitexecdir) relative

Signed-off-by: Johannes Sixt <johannes.sixt@telecom.at>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoAllow add_path() to add non-existent directories to the path
Johannes Sixt [Mon, 21 Jul 2008 19:19:55 +0000 (21:19 +0200)]
Allow add_path() to add non-existent directories to the path

This function had used make_absolute_path(); but this function dies if
the directory that contains the entry whose relative path was supplied in
the argument does not exist. This is a problem if the argument is, for
example, "../libexec/git-core", and that "../libexec" does not exist.

Since the resolution of symbolic links is not required for elements in
PATH, we can fall back to using make_nonrelative_path(), which simply
prepends $PWD to the path.

We have to move make_nonrelative_path() alongside make_absolute_path() in
abspath.c so that git-shell can be linked. See 5b8e6f85f.

Signed-off-by: Johannes Sixt <johannes.sixt@telecom.at>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoAllow the built-in exec path to be relative to the command invocation path
Johannes Sixt [Wed, 23 Jul 2008 19:12:18 +0000 (21:12 +0200)]
Allow the built-in exec path to be relative to the command invocation path

If GIT_EXEC_PATH (the macro that is defined in the Makefile) is relative,
it is interpreted relative to the command's invocation path, which usually
is $(bindir).

The Makefile rules were written with the assumption that $(gitexecdir) is
an absolute path. We introduce a separate variable that names the
(absolute) installation directory.

Signed-off-by: Johannes Sixt <johannes.sixt@telecom.at>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoFix relative built-in paths to be relative to the command invocation
Johannes Sixt [Mon, 21 Jul 2008 19:19:53 +0000 (21:19 +0200)]
Fix relative built-in paths to be relative to the command invocation

$(gitexecdir) (as defined in the Makefile) has gained another path
component, but the relative paths in the MINGW section of the Makefile,
which are interpreted relative to it, do not account for it.

Instead of adding another ../ in front of the path, we change the code that
constructs the absolute paths to do it relative to the command's directory,
which is essentially $(bindir). We do it this way because we will also
allow a relative $(gitexecdir) later.

Signed-off-by: Johannes Sixt <johannes.sixt@telecom.at>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoRecord the command invocation path early
Johannes Sixt [Mon, 21 Jul 2008 19:19:52 +0000 (21:19 +0200)]
Record the command invocation path early

We will need the command invocation path in system_path(). This path was
passed to setup_path(), but  system_path() can be called earlier, for
example via:

    main
      commit_pager_choice
        setup_pager
          git_config
            git_etc_gitconfig
              system_path

Therefore, we introduce git_set_argv0_path() and call it as soon as
possible.

Signed-off-by: Johannes Sixt <johannes.sixt@telecom.at>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoMakefile: Normalize $(bindir) and $(gitexecdir) before comparing
Johannes Sixt [Mon, 21 Jul 2008 19:19:51 +0000 (21:19 +0200)]
Makefile: Normalize $(bindir) and $(gitexecdir) before comparing

The install target needs to check whether the user has opted to make
$(gitexecdir) equal to $(bindir). It did so by a straight string
comparison. Since we are going to allow a relative $(gitexecdir), we have
to normalize paths before comparison, which we do with $(cd there && pwd).

The normalized paths are stored in shell variables. These we can now
reuse in the subsequent install statements, which conveniently shortens
the lines a bit.

Signed-off-by: Johannes Sixt <johannes.sixt@telecom.at>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoMakefile: Do not install a copy of 'git' in $(gitexecdir)
Johannes Sixt [Mon, 21 Jul 2008 19:19:50 +0000 (21:19 +0200)]
Makefile: Do not install a copy of 'git' in $(gitexecdir)

There is already a copy in $(bindir). A subsequent patch will enable git
to derive the exec-path from its invocation path. If git is invoked
recursively, the first invocation puts the exec-path into PATH, so that
the recursive invocation would find the instance in the exec-path. This
second instance would again try to derive an exec-path from its invocation
path, but would base its result on the wrong "bindir".

We do install the copy of git first, but remove it later, so that we can
use it as the source of the hardlinks for the builtins.

Signed-off-by: Johannes Sixt <johannes.sixt@telecom.at>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoarchive: allow --exec and --remote without equal sign
Rene Scharfe [Fri, 25 Jul 2008 10:41:25 +0000 (12:41 +0200)]
archive: allow --exec and --remote without equal sign

Allow "--remote repo" and "--exec cmd" in addition to "--remote=repo" and
"--exec=cmd" to make their usage consistent with parameters handled by
parse_options().

Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoarchive: declare struct archiver where it's needed
Rene Scharfe [Fri, 25 Jul 2008 10:41:24 +0000 (12:41 +0200)]
archive: declare struct archiver where it's needed

Move the declaration of struct archiver to archive.c, as this is the only
file left where it is used.

Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoarchive: define MAX_ARGS where it's needed
Rene Scharfe [Fri, 25 Jul 2008 10:41:23 +0000 (12:41 +0200)]
archive: define MAX_ARGS where it's needed

MAX_EXTRA_ARGS is not used anymore, so remove it.  MAX_ARGS is used only
in builtin-upload-archive.c, so define it there.  Also report the actual
value we're comparing against when the number of args is too big.

Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoarchive: move parameter parsing code to archive.c
Rene Scharfe [Fri, 25 Jul 2008 10:41:22 +0000 (12:41 +0200)]
archive: move parameter parsing code to archive.c

write_archive() in archive.c is the only callsite for the command line
parsing functions located in builtin-archive.c.  Move them to the place
where they are used, un-export them and make them static, as hinted at
by Stephan.

Cc: Stephan Beyer <s-beyer@gmx.net>
Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoarchive: add write_archive()
Rene Scharfe [Fri, 25 Jul 2008 10:41:21 +0000 (12:41 +0200)]
archive: add write_archive()

Both archive and upload-archive have to parse command line arguments and
then call the archiver specific write function.  Move the duplicate code
to a new function, write_archive().

Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoRemove references to git-fetch-pack from "git clone" documentation.
Steve Haslam [Fri, 25 Jul 2008 18:37:48 +0000 (19:37 +0100)]
Remove references to git-fetch-pack from "git clone" documentation.

"git clone" no longer calls "git-fetch-pack", so the documentation is a bit
stale. Instead, state that the -u option is to be used when accessing a
repository over ssh.

Signed-off-by: Steve Haslam <shaslam@lastminute.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agogit-am: Mention --abort in usage string part of OPTIONS_SPEC
Stephan Beyer [Fri, 25 Jul 2008 18:22:23 +0000 (20:22 +0200)]
git-am: Mention --abort in usage string part of OPTIONS_SPEC

The three separate lines for --skip, --resolved and --abort
are merged into one so that it is easy to see that they're
alternative and related options.

Signed-off-by: Stephan Beyer <s-beyer@gmx.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 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>
15 years agoeditor.c: Libify launch_editor()
Stephan Beyer [Fri, 25 Jul 2008 16:28:42 +0000 (18:28 +0200)]
editor.c: Libify launch_editor()

This patch removes exit()/die() calls and builtin-specific messages
from launch_editor(), so that it can be used as a general libgit.a
function to launch an editor.

Signed-off-by: Stephan Beyer <s-beyer@gmx.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoMove launch_editor() from builtin-tag.c to editor.c
Stephan Beyer [Fri, 25 Jul 2008 16:28:41 +0000 (18:28 +0200)]
Move launch_editor() from builtin-tag.c to editor.c

launch_editor() is declared in strbuf.h but defined in builtin-tag.c.
This patch moves launch_editor() into a new source file editor.c,
but keeps the declaration in strbuf.h.

Signed-off-by: Stephan Beyer <s-beyer@gmx.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agogit-gui: Correct 'Visualize Branches' on Mac OS X to start gitk
Shawn O. Pearce [Fri, 25 Jul 2008 22:08:33 +0000 (15:08 -0700)]
git-gui: Correct 'Visualize Branches' on Mac OS X to start gitk

In Git 1.6 and later gitk is in $prefix/bin while git-gui and all
of the other commands are in $gitexecdir, which is typically not
the same as $prefix/bin.  So we cannot launch $gitexecdir/gitk and
expect it to actually start gitk properly.

By allowing git-gui to locate the script via $PATH and then using
exactly that path when we source it during the application start
we can correctly run gitk on any Git 1.5 or later.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
15 years agogit-gui: Look for gitk in $PATH, not $LIBEXEC/git-core
Abhijit Menon-Sen [Thu, 24 Jul 2008 13:28:53 +0000 (18:58 +0530)]
git-gui: Look for gitk in $PATH, not $LIBEXEC/git-core

Signed-off-by: Abhijit Menon-Sen <ams@toroid.org>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
15 years agoMerge branch 'maint'
Junio C Hamano [Fri, 25 Jul 2008 20:56:36 +0000 (13:56 -0700)]
Merge branch 'maint'

* maint:
  Makefile: fix shell quoting
  tests: propagate $(TAR) down from the toplevel Makefile
  index-pack.c: correctly initialize appended objects
  send-email: find body-encoding correctly

15 years agoDocumentation: clarify how to disable elements in core.whitespace
Junio C Hamano [Fri, 25 Jul 2008 07:34:47 +0000 (00:34 -0700)]
Documentation: clarify how to disable elements in core.whitespace

Noticed by Peter Valdemar Mørch.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoMakefile: fix shell quoting
Junio C Hamano [Fri, 25 Jul 2008 19:35:10 +0000 (12:35 -0700)]
Makefile: fix shell quoting

Makefile records paths to a few programs in GIT-BUILD-OPTIONS file.  These
paths need to be quoted twice: once to protect specials from the shell
that runs the generated GIT-BUILD-OPTIONS file, and again to protect them
(and the first level of quoting itself) from the shell that runs the
"echo" inside the Makefile.

You can test this by trying:

    $ ln -s /bin/tar "$HOME/Tes' program/tar"
    $ make TAR="$HOME/Tes' program/tar" test

Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agotests: propagate $(TAR) down from the toplevel Makefile
Junio C Hamano [Fri, 25 Jul 2008 18:09:48 +0000 (11:09 -0700)]
tests: propagate $(TAR) down from the toplevel Makefile

Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoindex-pack.c: correctly initialize appended objects
Björn Steinbrink [Thu, 24 Jul 2008 17:32:00 +0000 (18:32 +0100)]
index-pack.c: correctly initialize appended objects

When index-pack completes a thin pack it appends objects to the pack.
Since the commit 92392b4(index-pack: Honor core.deltaBaseCacheLimit when
resolving deltas) such an object can be pruned in case of memory
pressure, and will be read back again by get_data_from_pack().  For this
to work, the fields in object_entry structure need to be initialized
properly.

Noticed by Pierre Habouzit.

Signed-off-by: Björn Steinbrink <B.Steinbrink@gmx.de>
Acked-by: Nicolas Pitre <nico@cam.org>
Acked-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agosend-email: find body-encoding correctly
Peter Valdemar Mørch [Fri, 25 Jul 2008 13:06:48 +0000 (15:06 +0200)]
send-email: find body-encoding correctly

In 8291db6 (git-send-email: add charset header if we add encoded 'From',
2007-11-16), "$1" is used from a regexp without using () to capture
anything in $1. Later, when that value was used, it causes a warning about
a variable being undefined, instead of using the correct value for
comparison (not that it makes difference in the current code that does not
do actual re-encoding).

Signed-off-by: Peter Valdemar Mørch <peter@morch.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agodocument that git-tag can tag more than heads
Jonathan Nieder [Thu, 24 Jul 2008 16:55:25 +0000 (11:55 -0500)]
document that git-tag can tag more than heads

After looking the git-tag manpage, someone on #git wondered how
to tag a commit that is not a branch head.  This patch changes
the synopsis to say "<commit> | <object>" instead of "<head>" to
address his question.

Samuel Bronson had the idea of putting "<commit> | <object>"
for "<object>" because most tags point to commits (and for the
rest of the manpage, all tags point to commits).

Signed-off-by: Jonathan Nieder <jrnieder@uchicago.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoperl/Makefile: update NO_PERL_MAKEMAKER section
Brandon Casey [Tue, 22 Jul 2008 21:15:41 +0000 (16:15 -0500)]
perl/Makefile: update NO_PERL_MAKEMAKER section

The perl modules must be copied to blib/lib so they are available for
testing.

Signed-off-by: Brandon Casey <casey@nrlssc.navy.mil>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agobash: offer only paths after '--' for 'git checkout'
SZEDER Gábor [Wed, 23 Jul 2008 11:49:22 +0000 (13:49 +0200)]
bash: offer only paths after '--' for 'git checkout'

Commit d773c631 (bash: offer only paths after '--', 2008-07-08) did the
same for several other git commands, but 'git checkout' went unnoticed.

Signed-off-by: SZEDER Gábor <szeder@ira.uka.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>