Code

git.git
16 years agoMerge branch 'jc/clean-fix'
Junio C Hamano [Fri, 7 Dec 2007 07:43:35 +0000 (23:43 -0800)]
Merge branch 'jc/clean-fix'

* jc/clean-fix:
  t7300: add test for clean with wildcard pathspec
  git-clean: Honor pathspec.

16 years agoautoconf: Add test for OLD_ICONV (squelching compiler warning)
Jakub Narebski [Fri, 7 Dec 2007 01:27:20 +0000 (02:27 +0100)]
autoconf: Add test for OLD_ICONV (squelching compiler warning)

Update configure.ac (and config.mak.in) to keep up with git
development by adding [compile] test whether your library has an old
iconv(), where the second (input buffer pointer) parameter is declared
with type (const char **) (OLD_ICONV).

Test-proposed-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoSilence iconv warnings on Leopard
Wincent Colaiuta [Thu, 6 Dec 2007 19:07:03 +0000 (20:07 +0100)]
Silence iconv warnings on Leopard

Apple ships a newer version of iconv with Leopard (Mac OS X 10.5/Darwin
9). Ensure that OLD_ICONV is not set on any version of Darwin in the
9.x series; this should be good for at least a couple of years, when
Darwin 10 comes out and we can invert the sense of the test to
specifically check for Darwin 7 or 8.

A more sophisticated and robust check is possible for those who use
autoconf, but not everybody does that.

Signed-off-by: Wincent Colaiuta <win@wincent.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoMerge branch 'maint'
Junio C Hamano [Fri, 7 Dec 2007 07:20:18 +0000 (23:20 -0800)]
Merge branch 'maint'

* maint:
  Change from using email.com to example.com as example domain, as per RFC 2606.

16 years agoChange from using email.com to example.com as example domain, as per RFC 2606.
David Symonds [Thu, 6 Dec 2007 23:36:45 +0000 (10:36 +1100)]
Change from using email.com to example.com as example domain, as per RFC 2606.

Signed-off-by: David Symonds <dsymonds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agogit-status documentation: mention subdirectory behaviour
Junio C Hamano [Thu, 6 Dec 2007 17:15:39 +0000 (09:15 -0800)]
git-status documentation: mention subdirectory behaviour

Consistently with all other diff oriented commands, we have given paths
relative to the work tree root in git-status output for a long time.
This documents the recent behaviour change, as people's eyes (and worse
yet, scripts, although scripts should not parse "git status" output) may
depend on the old behaviour.

In the longer run, giving a --full-name option to git-diff Porcelain
similar to what ls-files has, and change the default for git-diff
Porcelain to show relative paths may be a good thing to do, in order to
hide the oddballness of this git-status behaviour, but that would have a
rather large impact to established expectation by existing users.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agodo not discard status in fetch_refs_via_pack()
Junio C Hamano [Wed, 5 Dec 2007 07:01:19 +0000 (23:01 -0800)]
do not discard status in fetch_refs_via_pack()

The code calls fetch_pack() to get the list of refs it fetched, and
discards refs and always returns 0 to signal success.

But builtin-fetch-pack.c::fetch_pack() has error cases.  The function
returns NULL if error is detected (shallow-support side seems to choose
to die but I suspect that is easily fixable to error out as well).

Make fetch_refs_via_pack() propagate that error to the caller.

Acked-By: Daniel Barkalow <barkalow@iabervon.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agofor-each-ref: Fix quoting style constants.
Johannes Sixt [Thu, 6 Dec 2007 12:24:39 +0000 (13:24 +0100)]
for-each-ref: Fix quoting style constants.

for-each-ref can accept only one quoting style. For this reason it uses
OPT_BIT for the quoting style switches so that it is easy to check for
more than one bit being set. However, not all symbolic constants were
actually single bit values. In particular:

    $ git for-each-ref --python
    error: more than one quoting style ?

This fixes it.

While we are here, let's also remove the space before the question mark.

Signed-off-by: Johannes Sixt <johannes.sixt@telecom.at>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agohg-to-git: handle an empty dir in hg.
Junio C Hamano [Thu, 6 Dec 2007 15:26:29 +0000 (07:26 -0800)]
hg-to-git: handle an empty dir in hg.

Mark Drago had a subversion repository which was then converted to hg
and now is moving in to git.  The first commit in the svn repo was
just the creation of the empty directory.  This made its way in to the
hg repository fine, but converting from hg to git would cause an
error.  The problem was that hg-to-git.py tries to commit the change,
git-commit fails, and then hg-to-git.py tries to checkout the new
revision and that fails (because it was not created).  This may have
only caused an error because it was the first commit in the
repository.  If an empty directory was added in the middle of the repo
somewhere things might have worked out fine.

This patch will use the new --allow-empty option to git-commit to
record such an "empty" commit, to reproduce the history recorded in hg
more faithfully.

Tested-by: Mark Drago <markdrago@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agot7300: add test for clean with wildcard pathspec
Jeff King [Thu, 6 Dec 2007 03:28:06 +0000 (22:28 -0500)]
t7300: add test for clean with wildcard pathspec

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agogit-clean: Honor pathspec.
Junio C Hamano [Wed, 5 Dec 2007 07:55:41 +0000 (23:55 -0800)]
git-clean: Honor pathspec.

git-clean "*.rej" should attempt to look at only paths that match
pattern "*.rej", but rewrite to C broke it.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoDocumentation: color.* = true means "auto"
Junio C Hamano [Thu, 6 Dec 2007 01:05:17 +0000 (17:05 -0800)]
Documentation: color.* = true means "auto"

We forgot to document the earlier sanity-fix.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoMerge branch 'maint'
Junio C Hamano [Thu, 6 Dec 2007 01:49:13 +0000 (17:49 -0800)]
Merge branch 'maint'

* maint:
  git-am -i: report rewritten title
  git grep shows the same hit repeatedly for unmerged paths
  Do check_repository_format() early (re-fix)
  Do check_repository_format() early
  Add missing inside_work_tree setting in setup_git_directory_gently

16 years agogit-am -i: report rewritten title
Junio C Hamano [Wed, 5 Dec 2007 07:01:30 +0000 (23:01 -0800)]
git-am -i: report rewritten title

Jeff Garzik noticed that "git am -i" reports the applied patch with
the title before the user edited it.  This was confusing.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agogit grep shows the same hit repeatedly for unmerged paths
Junio C Hamano [Thu, 6 Dec 2007 00:13:08 +0000 (16:13 -0800)]
git grep shows the same hit repeatedly for unmerged paths

When the index is unmerged, e.g.

$ git ls-files -u
        100644 faf413748eb6ccb15161a212156c5e348302b1b6 1 setup.c
        100644 145eca50f41d811c4c8fcb21ed2604e6b2971aba 2 setup.c
        100644 cb9558c49b6027bf225ba2a6154c4d2a52bcdbe2 3 setup.c

running "git grep" for work tree files repeats hits for each unmerged
stage.

$ git grep -n -e setup_work_tree -- '*.[ch]'
        setup.c:209:void setup_work_tree(void)
        setup.c:209:void setup_work_tree(void)
        setup.c:209:void setup_work_tree(void)

This should fix it.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoMerge branch 'nd/maint-work-tree-fix' into maint
Junio C Hamano [Wed, 5 Dec 2007 23:07:23 +0000 (15:07 -0800)]
Merge branch 'nd/maint-work-tree-fix' into maint

* nd/maint-work-tree-fix:
  Do check_repository_format() early (re-fix)
  Do check_repository_format() early
  Add missing inside_work_tree setting in setup_git_directory_gently

16 years agoDo check_repository_format() early (re-fix)
Nguyễn Thái Ngọc Duy [Wed, 5 Dec 2007 13:33:32 +0000 (20:33 +0700)]
Do check_repository_format() early (re-fix)

This pushes check_repository_format() (actually _gently() version)
to setup_git_directory_gently() in order to prevent from
using unsupported repositories.

New setup_git_directory_gently()'s behaviour is stop searching
for a valid gitdir and return as if there is no gitdir if a
unsupported repository is found. Warning will be thrown in these
cases.

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoRevert "git-am: catch missing author date early."
Junio C Hamano [Wed, 5 Dec 2007 21:16:35 +0000 (13:16 -0800)]
Revert "git-am: catch missing author date early."

This reverts commit 6e9e0327b7d7f384d8a223b4bc40330ef3e7fb61.  People
can prepare a text file with Subject: and From: headers and feed it to
"am" (pretending the file is a piece of e-mail), and have actually been
doing so.  Strict checking for Date: breaks this established workflow,
which wants to record the time of the commit as the author time.

Thanks go to Jens Axboe for injection of sanity.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agogit config: Don't rely on regexec() returning 1 on non-match
Björn Steinbrink [Wed, 5 Dec 2007 15:11:24 +0000 (16:11 +0100)]
git config: Don't rely on regexec() returning 1 on non-match

Some systems don't return 1 from regexec() when the pattern does not
match (notably HP-UX which returns 20).

Bug identified by Dscho and H.Merijn Brand.

Signed-off-by: Björn Steinbrink <B.Steinbrink@gmx.de>
Tested-by: H.Merijn Brand <h.m.brand@xs4all.nl>
Cc: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoDocumentation: add --patch option to synopsis of git-add
Matthias Kestenholz [Wed, 5 Dec 2007 11:28:50 +0000 (12:28 +0100)]
Documentation: add --patch option to synopsis of git-add

Signed-off-by: Matthias Kestenholz <matthias@spinlock.ch>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoSet OLD_ICONV on Cygwin.
Pascal Obry [Sat, 1 Dec 2007 09:49:22 +0000 (10:49 +0100)]
Set OLD_ICONV on Cygwin.

Cygwin still has old definition for the iconv() second
parameter. This patch fixes the last warning on Cygwin.
This has been tested with Cygwin 1.5.24.

Signed-off-by: Pascal Obry <pascal@obry.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agot5510: add a bit more tests for fetch
Junio C Hamano [Wed, 5 Dec 2007 05:58:42 +0000 (21:58 -0800)]
t5510: add a bit more tests for fetch

"git pull/fetch" that gets explicit refspecs from the command line should
not update configured tracking refs.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoMerge branch 'wc/add-i'
Junio C Hamano [Wed, 5 Dec 2007 05:38:28 +0000 (21:38 -0800)]
Merge branch 'wc/add-i'

* wc/add-i:
  git-add -i: add help text for list-and-choose UI
  add -i: allow prefix highlighting for "Add untracked" as well.
  Highlight keyboard shortcuts in git-add--interactive
  Document all help keys in "git add -i" patch mode.
  Add "--patch" option to git-add--interactive
  add -i: Fix running from a subdirectory
  builtin-add: fix command line building to call interactive
  git-add -i: allow multiple selection in patch subcommand
  Add path-limiting to git-add--interactive
  Teach builtin-add to pass multiple paths to git-add--interactive

16 years agoMerge branch 'kh/commit'
Junio C Hamano [Wed, 5 Dec 2007 01:16:33 +0000 (17:16 -0800)]
Merge branch 'kh/commit'

* kh/commit: (33 commits)
  git-commit --allow-empty
  git-commit: Allow to amend a merge commit that does not change the tree
  quote_path: fix collapsing of relative paths
  Make git status usage say git status instead of git commit
  Fix --signoff in builtin-commit differently.
  git-commit: clean up die messages
  Do not generate full commit log message if it is not going to be used
  Remove git-status from list of scripts as it is builtin
  Fix off-by-one error when truncating the diff out of the commit message.
  builtin-commit.c: export GIT_INDEX_FILE for launch_editor as well.
  Add a few more tests for git-commit
  builtin-commit: Include the diff in the commit message when verbose.
  builtin-commit: fix partial-commit support
  Fix add_files_to_cache() to take pathspec, not user specified list of files
  Export three helper functions from ls-files
  builtin-commit: run commit-msg hook with correct message file
  builtin-commit: do not color status output shown in the message template
  file_exists(): dangling symlinks do exist
  Replace "runstatus" with "status" in the tests
  t7501-commit: Add test for git commit <file> with dirty index.
  ...

16 years agoMerge branch 'sp/refspec-match'
Junio C Hamano [Wed, 5 Dec 2007 01:07:10 +0000 (17:07 -0800)]
Merge branch 'sp/refspec-match'

* sp/refspec-match:
  refactor fetch's ref matching to use refname_match()
  push: use same rules as git-rev-parse to resolve refspecs
  add refname_match()
  push: support pushing HEAD to real branch name

16 years agoSimplify crud() in ident.c
Alex Riesen [Mon, 3 Dec 2007 19:11:43 +0000 (20:11 +0100)]
Simplify crud() in ident.c

Signed-off-by: Alex Riesen <raa.lkml@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoDo not rely on the exit status of "unset" for unset variables
H.Merijn Brand [Tue, 4 Dec 2007 22:45:16 +0000 (22:45 +0000)]
Do not rely on the exit status of "unset" for unset variables

POSIX says that exit status "0" means that "unset" successfully unset
the variable.  However, it is kind of ambiguous if an environment
variable which was not set could be successfully unset.

At least the default shell on HP-UX insists on reporting an error in
such a case, so just ignore the exit status of "unset".

[Dscho: extended the patch to git-submodule.sh, as Junio realized that
 this is the only other place where we check the exit status of "unset".]

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agogitweb: use Perl built-in utf8 function for UTF-8 decoding.
İsmail Dönmez [Tue, 4 Dec 2007 08:55:41 +0000 (10:55 +0200)]
gitweb: use Perl built-in utf8 function for UTF-8 decoding.

Signed-off-by: İsmail Dönmez <ismail@pardus.org.tr>
Tested-by: Martin Koegler <mkoegler@auto.tuwien.ac.at>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agot9600: require cvsps 2.1 to perform tests
Jeff King [Tue, 4 Dec 2007 01:41:45 +0000 (20:41 -0500)]
t9600: require cvsps 2.1 to perform tests

git-cvsimport won't run at all with less than cvsps 2.1, because it
lacks the -A flag. But there's no point in preventing people who have an
old cvsps from running the full testsuite.

Tested-by: A Large Angry SCM <gitzilla@gmail.com>
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agocontrib: Make remotes2config.sh script more robust
Jakub Narebski [Sun, 2 Dec 2007 19:40:43 +0000 (20:40 +0100)]
contrib: Make remotes2config.sh script more robust

The remotes2config.sh script replaced all 'unsafe' characters in repo
name with '.'; include '-' in the 'safe' characters set (the set is
probably even larger).

Script required also space after "URL:", "Push:" and "Pull:" in
remotes file. This for example made the following remote
  URL: git://git.kernel.org/pub/scm/git/git.git
  Pull: refs/heads/master:refs/heads/origin
  Pull:+refs/heads/pu:refs/heads/pu
miss 'pu' branch (forced branch) in config file after conversion.
Allow for any number of whitespace after "URL:", "Push:", "Pull:".

Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoUse a strbuf for copying the command line for the reflog.
Kristian Høgsberg [Tue, 4 Dec 2007 07:25:46 +0000 (02:25 -0500)]
Use a strbuf for copying the command line for the reflog.

Signed-off-by: Kristian Høgsberg <krh@redhat.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoDocumentation/git.txt: typofix
Junio C Hamano [Tue, 4 Dec 2007 08:47:04 +0000 (00:47 -0800)]
Documentation/git.txt: typofix

Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoDocumentation: rerere is enabled by default these days.
Junio C Hamano [Tue, 4 Dec 2007 08:40:55 +0000 (00:40 -0800)]
Documentation: rerere is enabled by default these days.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoFormatting fix for Documentation/git-help.txt
Junio C Hamano [Tue, 4 Dec 2007 08:29:32 +0000 (00:29 -0800)]
Formatting fix for Documentation/git-help.txt

Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoUpdate draft release notes for 1.5.4
Junio C Hamano [Tue, 4 Dec 2007 07:13:02 +0000 (23:13 -0800)]
Update draft release notes for 1.5.4

Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoAllow ':/<oneline-prefix>' syntax to work with save_commit_buffer == 0
Johannes Schindelin [Mon, 3 Dec 2007 18:42:39 +0000 (18:42 +0000)]
Allow ':/<oneline-prefix>' syntax to work with save_commit_buffer == 0

Earlier, ':/<oneline-prefix>' would not work (i.e. die) with commands that
set save_commit_buffer = 0, such as blame, describe, pack-objects, reflog
and bundle.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoAdd git-fast-export to list of commands.
Junio C Hamano [Tue, 4 Dec 2007 05:56:09 +0000 (21:56 -0800)]
Add git-fast-export to list of commands.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agofast-export: rename the signed tag mode 'ignore' to 'verbatim'
Johannes Schindelin [Mon, 3 Dec 2007 22:44:39 +0000 (22:44 +0000)]
fast-export: rename the signed tag mode 'ignore' to 'verbatim'

The name 'verbatim' describes much better what this mode does with
signed tags.  While at it, fix the documentation what it actually
does.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoAdd remote.<name>.proxy
Sam Vilain [Mon, 3 Dec 2007 21:48:54 +0000 (10:48 +1300)]
Add remote.<name>.proxy

As well as allowing a default http.proxy option, allow it to be set
per-remote.

Signed-off-by: Sam Vilain <sam.vilain@catalyst.net.nz>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoAllow HTTP proxy to be overridden in config
Sam Vilain [Fri, 23 Nov 2007 00:07:00 +0000 (13:07 +1300)]
Allow HTTP proxy to be overridden in config

The http_proxy / HTTPS_PROXY variables used by curl to control
proxying may not be suitable for git.  Allow the user to override them
in the configuration file.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoTrace and quote with argv: get rid of unneeded count argument.
Christian Couder [Mon, 3 Dec 2007 04:51:50 +0000 (05:51 +0100)]
Trace and quote with argv: get rid of unneeded count argument.

Now that str_buf takes care of all the allocations, there is
no more gain to pass an argument count.

So this patch removes the "count" argument from:
- "sq_quote_argv"
- "trace_argv_printf"
and all the callers.

Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoinstall-sh from automake does not like -m without delimiting space
Robert Schiele [Sat, 1 Dec 2007 17:05:40 +0000 (18:05 +0100)]
install-sh from automake does not like -m without delimiting space

The install-sh script as shipped with automake requires a space between
the -m switch and its argument.  Since this is also the regular way of
doing it with other install implementations this change inserts the
missing space in all makefiles.

Signed-off-by: Robert Schiele <rschiele@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoDocumentation: add a new man page for "git-help"
Christian Couder [Tue, 4 Dec 2007 05:44:29 +0000 (06:44 +0100)]
Documentation: add a new man page for "git-help"

Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agogit-commit documentation: fix unfinished sentence.
Junio C Hamano [Mon, 3 Dec 2007 21:35:26 +0000 (13:35 -0800)]
git-commit documentation: fix unfinished sentence.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agogit-add -i: add help text for list-and-choose UI
Wincent Colaiuta [Mon, 3 Dec 2007 08:09:43 +0000 (09:09 +0100)]
git-add -i: add help text for list-and-choose UI

Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agogit-commit --allow-empty
Junio C Hamano [Mon, 3 Dec 2007 08:03:10 +0000 (00:03 -0800)]
git-commit --allow-empty

It does not usually make sense to record a commit that has the exact
same tree as its sole parent commit and that is why git-commit prevents
you from making such a mistake, but when data from foreign scm is
involved, it is a different story.  We are equipped to represent such an
(perhaps insane, perhaps by mistake, or perhaps done on purpose) empty
change, and it is better to represent it bypassing the safety valve for
native use.

This is primarily for use by foreign scm interface scripts.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agogit-commit --allow-empty
Junio C Hamano [Mon, 3 Dec 2007 08:03:10 +0000 (00:03 -0800)]
git-commit --allow-empty

It does not usually make sense to record a commit that has the exact
same tree as its sole parent commit and that is why git-commit prevents
you from making such a mistake, but when data from foreign scm is
involved, it is a different story.  We are equipped to represent such an
(perhaps insane, perhaps by mistake, or perhaps done on purpose) empty
change, and it is better to represent it bypassing the safety valve for
native use.

This is primarily for use by foreign scm interface scripts.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agogit-commit: Allow to amend a merge commit that does not change the tree
Johannes Sixt [Mon, 3 Dec 2007 07:24:50 +0000 (08:24 +0100)]
git-commit: Allow to amend a merge commit that does not change the tree

Normally, it should not be allowed to generate an empty commit. A merge
commit generated with git 'merge -s ours' does not change the tree (along
the first parent), but merges are not "empty" even if they do not change
the tree. Hence, commit 8588452ceb7 allowed to amend a merge commit that
does not change the tree, but 4fb5fd5d301 disallowed it again in an
attempt to avoid that an existing commit is amended such that it becomes
empty. With this change, a commit can be edited (create a new one or amend
an existing one) either if there are changes or if there are at least two
parents.

Signed-off-by: Johannes Sixt <johannes.sixt@telecom.at>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agogit-commit: Allow to amend a merge commit that does not change the tree
Junio C Hamano [Mon, 3 Dec 2007 07:55:23 +0000 (23:55 -0800)]
git-commit: Allow to amend a merge commit that does not change the tree

Normally, it should not be allowed to generate an empty commit. A merge
commit generated with git 'merge -s ours' does not change the tree (along
the first parent), but merges are not "empty" even if they do not change
the tree. Hence, we should be careful not to forbid this case.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoquote_path: fix collapsing of relative paths
Jeff King [Mon, 3 Dec 2007 05:30:01 +0000 (00:30 -0500)]
quote_path: fix collapsing of relative paths

The code tries to collapse identical leading components
between the prefix and the path. So if we're in "dir1", the
path "dir1/file" should become just "file". However, we were
ending up with "../dir1/file". The included test expected
the wrong output.

The "len" parameter to quote_path can be negative to mean
"this is a NUL terminated string".  Simply count it so that
the loop can rely on it being the length of the path.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoMake git status usage say git status instead of git commit
Shawn Bohrer [Mon, 3 Dec 2007 05:02:09 +0000 (23:02 -0600)]
Make git status usage say git status instead of git commit

git status shares the same usage information as git commit since it
shows what would be committed if the same options are given.  However,
when displaying the usage information for git status it should say it
is for git status not git commit.

Signed-off-by: Shawn Bohrer <shawn.bohrer@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoFix --signoff in builtin-commit differently.
Junio C Hamano [Sun, 2 Dec 2007 21:43:34 +0000 (13:43 -0800)]
Fix --signoff in builtin-commit differently.

Introduce fmt_name() specifically meant for formatting the name and
email pair, to add signed-off-by value.  This reverts parts of
13208572fbe8838fd8835548d7502202d1f7b21d (builtin-commit: fix --signoff)
so that an empty datestamp string given to fmt_ident() by mistake will
error out as before.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoMerge branch 'js/prune-expire'
Junio C Hamano [Mon, 3 Dec 2007 07:03:38 +0000 (23:03 -0800)]
Merge branch 'js/prune-expire'

* js/prune-expire:
  Add "--expire <time>" option to 'git prune'

16 years agoMerge branch 'js/export-with-assignment'
Junio C Hamano [Mon, 3 Dec 2007 07:01:25 +0000 (23:01 -0800)]
Merge branch 'js/export-with-assignment'

* js/export-with-assignment:
  Replace instances of export VAR=VAL with VAR=VAL; export VAR

16 years agoMerge branch 'js/fast-export'
Junio C Hamano [Mon, 3 Dec 2007 07:01:15 +0000 (23:01 -0800)]
Merge branch 'js/fast-export'

* js/fast-export:
  Add 'git fast-export', the sister of 'git fast-import'

16 years agoMerge branch 'js/rebase-i-rerere'
Junio C Hamano [Mon, 3 Dec 2007 07:01:02 +0000 (23:01 -0800)]
Merge branch 'js/rebase-i-rerere'

* js/rebase-i-rerere:
  rebase -i: give rerere a chance

16 years agoMerge branch 'js/pull-rebase'
Junio C Hamano [Mon, 3 Dec 2007 07:00:43 +0000 (23:00 -0800)]
Merge branch 'js/pull-rebase'

* js/pull-rebase:
  Teach 'git pull' about --rebase

16 years agoMerge branch 'wc/rebase-insn'
Junio C Hamano [Mon, 3 Dec 2007 07:00:28 +0000 (23:00 -0800)]
Merge branch 'wc/rebase-insn'

* wc/rebase-insn:
  Mention that git-rm can be an appropriate resolution as well as git-add.
  revert/cherry-pick: Allow overriding the help text by the calling Porcelain

16 years agoMerge branch 'jc/typebreak'
Junio C Hamano [Mon, 3 Dec 2007 06:59:28 +0000 (22:59 -0800)]
Merge branch 'jc/typebreak'

* jc/typebreak:
  Enable rewrite as well as rename detection in git-status
  rename: Break filepairs with different types.

16 years agoEnable rewrite as well as rename detection in git-status
Jeff King [Mon, 3 Dec 2007 06:58:37 +0000 (22:58 -0800)]
Enable rewrite as well as rename detection in git-status

Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoMerge branch 'jc/color'
Junio C Hamano [Mon, 3 Dec 2007 06:49:58 +0000 (22:49 -0800)]
Merge branch 'jc/color'

* jc/color:
  git-config --get-color: get configured color
  "color.diff = true" is not "always" anymore.

16 years agoAdd 'git fast-export', the sister of 'git fast-import'
Johannes Schindelin [Sun, 2 Dec 2007 14:14:13 +0000 (14:14 +0000)]
Add 'git fast-export', the sister of 'git fast-import'

This program dumps (parts of) a git repository in the format that
fast-import understands.

For clarity's sake, it does not use the 'inline' method of specifying
blobs in the commits, but builds the blobs before building the commits.

Since signed tags' signatures will not necessarily be valid (think
transformations after the export, or excluding revisions, changing
the history), there are 4 modes to handle them: abort (default),
ignore, warn and strip.  The latter just turns the tags into
unsigned ones.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoMerge branch 'dc/gitweb'
Junio C Hamano [Mon, 3 Dec 2007 03:07:48 +0000 (19:07 -0800)]
Merge branch 'dc/gitweb'

* dc/gitweb:
  gitweb: the commitdiff is very commonly used, it's needed on search page, too

16 years agogitweb: Update and improve gitweb/README file
Jakub Narebski [Sun, 2 Dec 2007 23:22:02 +0000 (00:22 +0100)]
gitweb: Update and improve gitweb/README file

Update list of build configuration variables, add references
to gitweb/INSTALL, add description of runtime and per-repository
runtime configuration.

Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agogit-stash: Display help message if git-stash is run with wrong sub-commands
Kevin Leung [Mon, 3 Dec 2007 02:34:05 +0000 (10:34 +0800)]
git-stash: Display help message if git-stash is run with wrong sub-commands

The current git-stash behaviour is very error prone to typos. For example,
if you typed "git-stash llist", git-stash would think that you wanted to
save to a stash named "llist", but in fact, you meant "git-stash list".

Signed-off-by: Kevin Leung <kevinlsk@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agogit-am: catch missing author date early.
Junio C Hamano [Sun, 2 Dec 2007 22:38:40 +0000 (14:38 -0800)]
git-am: catch missing author date early.

Even though commit-tree would default to the current time if the incoming
e-mail message somehow did not record the timestamp, it is safer to catch
the breakage sooner.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoadd -i: allow prefix highlighting for "Add untracked" as well.
Wincent Colaiuta [Sun, 2 Dec 2007 13:44:11 +0000 (14:44 +0100)]
add -i: allow prefix highlighting for "Add untracked" as well.

These changes make the automatic prefix highlighting work with the "Add
untracked" subcommand in git-add--interactive by explicitly handling
arrays, hashes and strings internally (previously only arrays and hashes
were handled).

In addition, prefixes which have special meaning for list_and_choose
(things like "*" for "all" and "-" for "deselect) are explicitly
excluded (highlighting these prefixes would be misleading).

Signed-off-by: Wincent Colaiuta <win@wincent.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoMerge branch 'maint'
Junio C Hamano [Sun, 2 Dec 2007 19:00:45 +0000 (11:00 -0800)]
Merge branch 'maint'

* maint:
  t9600: test cvsimport from CVS working tree

16 years agot9600: test cvsimport from CVS working tree
Jeff King [Sun, 2 Dec 2007 17:22:19 +0000 (12:22 -0500)]
t9600: test cvsimport from CVS working tree

This test passes with v1.5.3.7, but not with v1.5.3.6.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agogitweb: the commitdiff is very commonly used, it's needed on search page, too
Denis Cheng [Mon, 26 Nov 2007 12:42:06 +0000 (20:42 +0800)]
gitweb: the commitdiff is very commonly used, it's needed on search page, too

Acked-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agorename: Break filepairs with different types.
Junio C Hamano [Sat, 1 Dec 2007 06:22:38 +0000 (22:22 -0800)]
rename: Break filepairs with different types.

When we consider if a path has been totally rewritten, we did not
touch changes from symlinks to files or vice versa.  But a change
that modifies even the type of a blob surely should count as a
complete rewrite.

While we are at it, modernise diffcore-break to be aware of gitlinks (we
do not want to touch them).

Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agogit-commit: clean up die messages
Jeff King [Sun, 2 Dec 2007 06:07:03 +0000 (01:07 -0500)]
git-commit: clean up die messages

These are three types of cleanups here:

  1. remove newline from die message (die/report adds it
     already)
  2. typo: s/merger/merge/
  3. the old "* no commit message?  aborting commit." is now
     prepended with "fatal: ", making the asterisk look a
     little funny. Let's just remove it.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoUpdate draft release notes for 1.5.4
Junio C Hamano [Sun, 2 Dec 2007 07:45:31 +0000 (23:45 -0800)]
Update draft release notes for 1.5.4

Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoConsolidate command list to one.
Junio C Hamano [Sun, 2 Dec 2007 07:39:19 +0000 (23:39 -0800)]
Consolidate command list to one.

The categorized list of commands in git(7) and the list of common
commands in "git help" output were maintained separately, which was
insane.  This consolidates them to a single command-list.txt file.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoResurrect peek-remote
Junio C Hamano [Sun, 2 Dec 2007 07:38:35 +0000 (23:38 -0800)]
Resurrect peek-remote

8951d7c1f1ae38f34617b6c2490bf65e73e371f7 (Build in ls-remote) made
peek-remote as a synonym to ls-remote by enhancing the latter, but
at the same time actually _removed_ it, before we officially gave
removal notice.  This was bad.

Resurrect it for v1.5.4.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoMerge branch 'tt/help'
Junio C Hamano [Sun, 2 Dec 2007 04:05:49 +0000 (20:05 -0800)]
Merge branch 'tt/help'

* tt/help:
  Remove hint to use "git help -a"
  Make the list of common commands more exclusive

16 years agoMerge branch 'jc/move-gitk'
Junio C Hamano [Sat, 1 Dec 2007 21:58:57 +0000 (13:58 -0800)]
Merge branch 'jc/move-gitk'

* jc/move-gitk:
  Move gitk to its own subdirectory

16 years agoMerge branch 'jc/branch-contains'
Junio C Hamano [Sat, 1 Dec 2007 21:58:54 +0000 (13:58 -0800)]
Merge branch 'jc/branch-contains'

* jc/branch-contains:
  git-branch --contains: doc and test
  git-branch --contains=commit
  parse-options: Allow to hide options from the default usage.

16 years agoMerge branch 'cr/tag-options'
Junio C Hamano [Sat, 1 Dec 2007 21:58:46 +0000 (13:58 -0800)]
Merge branch 'cr/tag-options'

* cr/tag-options:
  git-tag: test that -s implies an annotated tag
  "git-tag -s" should create a signed annotated tag
  builtin-tag: accept and process multiple -m just like git-commit
  Make builtin-tag.c use parse_options.

16 years agoUpdate draft release notes for 1.5.4
Junio C Hamano [Sat, 1 Dec 2007 21:13:11 +0000 (13:13 -0800)]
Update draft release notes for 1.5.4

Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoMerge 1.5.3.7 in
Junio C Hamano [Sat, 1 Dec 2007 20:48:19 +0000 (12:48 -0800)]
Merge 1.5.3.7 in

Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoGIT 1.5.3.7 v1.5.3.7
Junio C Hamano [Sat, 1 Dec 2007 19:20:00 +0000 (11:20 -0800)]
GIT 1.5.3.7

Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoFix typo in t4008 test title
Junio C Hamano [Sat, 1 Dec 2007 19:06:41 +0000 (11:06 -0800)]
Fix typo in t4008 test title

Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agogit-svn: Don't create a "master" branch every time rebase is run
Steven Grimm [Thu, 29 Nov 2007 19:54:39 +0000 (11:54 -0800)]
git-svn: Don't create a "master" branch every time rebase is run

If you run "git-svn rebase" while sitting on a topic branch, there is
no need to create a "master" branch if one didn't exist already. The
branch was created implicitly by the automatic checkout after fetching,
which in the case of rebase isn't actually necessary anyway.

Signed-off-by: Steven Grimm <koreth@midwinter.com>
Acked-by: Eric Wong <normalperson@yhbt.net>
16 years agogit-svn: add a show-externals command.
Vineet Kumar [Mon, 19 Nov 2007 22:56:15 +0000 (14:56 -0800)]
git-svn: add a show-externals command.

show-externals can be used by scripts to provide svn:externals-like
functionality.  For example, a script can list all of the externals and then
use check out the listed URLs at the appropriate paths, similar to what the svn
client does.  Said script (or perhaps git-svn itself, in the future) could
simply invoke svn export on the paths, or it could go one further, using
git-svn clone and even git-submodule together to better integrate externals
checkouts.

The implementation is shamelessly copied from show-ignores.  A more general
command to list user-specified properties is probably a better idea.

Signed-off-by: Vineet Kumar <vineet@doorstop.net>
Acked-by: Eric Wong <normalperson@yhbt.net>
16 years agogit-svn: Remove unnecessary Git::SVN::Util package
David D. Kilzer [Thu, 22 Nov 2007 19:18:00 +0000 (11:18 -0800)]
git-svn: Remove unnecessary Git::SVN::Util package

Digest::MD5 is loaded regardless of the package in which it's
declared, so move its 'use' statement and the md5sum() function
into the main package.

Signed-off-by: David D. Kilzer <ddkilzer@kilzer.net>
Acked-by: Eric Wong <normalperson@yhbt.net>
16 years agogit-svn: add support for pulling author from From: and Signed-off-by:
Andy Whitcroft [Thu, 22 Nov 2007 13:44:42 +0000 (13:44 +0000)]
git-svn: add support for pulling author from From: and Signed-off-by:

Add support for pulling the real author of a commit from the From:
and first Signed-off-by: fields of the SVN commit message.

Signed-off-by: Andy Whitcroft <apw@shadowen.org>
Acked-by: Eric Wong <normalperson@yhbt.net>
16 years agogit-svn now reads settings even if called in subdirectory
Gustaf Hendeby [Sat, 24 Nov 2007 13:47:56 +0000 (14:47 +0100)]
git-svn now reads settings even if called in subdirectory

Previously, git-svn first read the .git/config file for settings as if
current working directory was the repository top-directory, and after
that made sure to cd into top-directory.  The result was a silent
failur to read configuration settings.  This patch changes the order
these two things are done.

Signed-off-by: Gustaf Hendeby <hendeby@isy.liu.se>
Acked-by: Eric Wong <normalperson@yhbt.net>
16 years agoMerge branch 'maint'
Junio C Hamano [Sat, 1 Dec 2007 00:21:33 +0000 (16:21 -0800)]
Merge branch 'maint'

* maint:
  Replace the word 'update-cache' by 'update-index' everywhere
  cvsimport: fix usage of cvsimport.module
  t7003-filter-branch: Fix test of a failing --msg-filter.
  cvsimport: miscellaneous packed-ref fixes
  cvsimport: use rev-parse to support packed refs
  Add basic cvsimport tests

16 years agoFix a pathological case in git detecting proper renames
Linus Torvalds [Fri, 30 Nov 2007 00:41:09 +0000 (16:41 -0800)]
Fix a pathological case in git detecting proper renames

On Thu, 29 Nov 2007, Jeff King wrote:
>
> I think it will get worse, because you are simultaneously calculating
> all of the similarity scores bit by bit rather than doing a loop. Though
> perhaps you mean at the end you will end up with a list of src/dst pairs
> sorted by score, and you can loop over that.

Well, after thinking about this a bit, I think there's a solution that may
work well with the current thing too: instead of looping just *once* over
the list of rename pairs, loop twice - and simply refuse to do copies on
the first loop.

This trivial patch does that, and turns Kumar's test-case into a perfect
rename list.

It's not pretty, it's not smart, but it seems to work. There's something
to be said for keeping it simple and stupid.

And it should not be nearly as expensive as it may _look_. Yes, the loop
is "(i = 0; i < num_create * num_src; i++)", but the important part is
that the whole array is sorted by rename score, and we have a

if (mx[i].score < minimum_score)
break;

in it, so uthe loop actually would tend to terminate rather quickly.

Anyway, Kumar, the thing to take away from this is:

 - git really doesn't even *care* about the whole "rename detection"
   internally, and any commits you have done with renames are totally
   independent of the heuristics we then use to *show* the renames.

 - the rename detection really is for just two reasons: (a) keep humans
   happy, and keep the diffs small and (b) help automatic merging across
   renames. So getting renames right is certainly good, but it's more of a
   "politeness" issue than a "correctness" issue, although the merge
   portion of it does matter a lot sometimes.

 - the important thing here is that you can commit your changes and not
   worry about them being somehow "corrupted" by lack of rename detection,
   even if you commit them with a version of git that doesn't do rename
   detection the way you expected it. The rename detection is an
   "after-the-fact" thing, not something that actually gets saved in the
   repository, which is why we can change the heuristics _after_ seeing
   examples, and the examples magically correct themselves!

 - try out the two patches I've posted, and see if they work for you. They
   pass the test-suite, and the output for your example commit looks sane,
   but hey, if you have other test-cases, try them out.

Here's Kumar's pretty diffstat with both my patches:

 Makefile                                         |    6 +++---
 board/{cds => freescale}/common/cadmus.c         |    0
 board/{cds => freescale}/common/cadmus.h         |    0
 board/{cds => freescale}/common/eeprom.c         |    0
 board/{cds => freescale}/common/eeprom.h         |    0
 board/{cds => freescale}/common/ft_board.c       |    0
 board/{cds => freescale}/common/via.c            |    0
 board/{cds => freescale}/common/via.h            |    0
 board/{cds => freescale}/mpc8541cds/Makefile     |    0
 board/{cds => freescale}/mpc8541cds/config.mk    |    0
 board/{cds => freescale}/mpc8541cds/init.S       |    0
 board/{cds => freescale}/mpc8541cds/mpc8541cds.c |    0
 board/{cds => freescale}/mpc8541cds/u-boot.lds   |    4 ++--
 board/{cds => freescale}/mpc8548cds/Makefile     |    0
 board/{cds => freescale}/mpc8548cds/config.mk    |    0
 board/{cds => freescale}/mpc8548cds/init.S       |    0
 board/{cds => freescale}/mpc8548cds/mpc8548cds.c |    0
 board/{cds => freescale}/mpc8548cds/u-boot.lds   |    4 ++--
 board/{cds => freescale}/mpc8555cds/Makefile     |    0
 board/{cds => freescale}/mpc8555cds/config.mk    |    0
 board/{cds => freescale}/mpc8555cds/init.S       |    0
 board/{cds => freescale}/mpc8555cds/mpc8555cds.c |    0
 board/{cds => freescale}/mpc8555cds/u-boot.lds   |    4 ++--
 23 files changed, 9 insertions(+), 9 deletions(-)

and here it is before:

 Makefile                                           |    6 +-
 board/cds/mpc8548cds/Makefile                      |   60 -----
 board/cds/mpc8555cds/Makefile                      |   60 -----
 board/cds/mpc8555cds/init.S                        |  255 --------------------
 board/cds/mpc8555cds/u-boot.lds                    |  150 ------------
 board/{cds => freescale}/common/cadmus.c           |    0
 board/{cds => freescale}/common/cadmus.h           |    0
 board/{cds => freescale}/common/eeprom.c           |    0
 board/{cds => freescale}/common/eeprom.h           |    0
 board/{cds => freescale}/common/ft_board.c         |    0
 board/{cds => freescale}/common/via.c              |    0
 board/{cds => freescale}/common/via.h              |    0
 board/{cds => freescale}/mpc8541cds/Makefile       |    0
 board/{cds => freescale}/mpc8541cds/config.mk      |    0
 board/{cds => freescale}/mpc8541cds/init.S         |    0
 board/{cds => freescale}/mpc8541cds/mpc8541cds.c   |    0
 board/{cds => freescale}/mpc8541cds/u-boot.lds     |    4 +-
 .../mpc8541cds => freescale/mpc8548cds}/Makefile   |    0
 board/{cds => freescale}/mpc8548cds/config.mk      |    0
 board/{cds => freescale}/mpc8548cds/init.S         |    0
 board/{cds => freescale}/mpc8548cds/mpc8548cds.c   |    0
 board/{cds => freescale}/mpc8548cds/u-boot.lds     |    4 +-
 .../mpc8541cds => freescale/mpc8555cds}/Makefile   |    0
 board/{cds => freescale}/mpc8555cds/config.mk      |    0
 .../mpc8541cds => freescale/mpc8555cds}/init.S     |    0
 board/{cds => freescale}/mpc8555cds/mpc8555cds.c   |    0
 .../mpc8541cds => freescale/mpc8555cds}/u-boot.lds |    4 +-
 27 files changed, 9 insertions(+), 534 deletions(-)

so it certainly makes the diffs prettier.

Linus

Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoFix a pathological case in git detecting proper renames
Linus Torvalds [Thu, 29 Nov 2007 21:30:13 +0000 (13:30 -0800)]
Fix a pathological case in git detecting proper renames

Kumar Gala had a case in the u-boot archive with multiple renames of files
with identical contents, and git would turn those into multiple "copy"
operations of one of the sources, and just deleting the other sources.

This patch makes the git exact rename detection prefer to spread out the
renames over the multiple sources, rather than do multiple copies of one
source.

NOTE! The changes are a bit larger than required, because I also renamed
the variables named "one" and "two" to "target" and "source" respectively.
That makes the logic easier to follow, especially as the "one" was
illogically the target and not the soruce, for purely historical reasons
(this piece of code used to traverse over sources and targets in the wrong
order, and when we fixed that, we didn't fix the names back then. So I
fixed them now).

The important part of this change is just the trivial score calculations
for when files have identical contents:

/* Give higher scores to sources that haven't been used already */
score = !source->rename_used;
score += basename_same(source, target);

and when we have multiple choices we'll now pick the choice that gets the
best rename score, rather than only looking at whether the basename
matched.

It's worth noting a few gotchas:

 - this scoring is currently only done for the "exact match" case.

   In particular, in Kumar's example, even after this patch, the inexact
   match case is still done as a copy+delete rather than as two renames:

 delete mode 100644 board/cds/mpc8555cds/u-boot.lds
 copy board/{cds => freescale}/mpc8541cds/u-boot.lds (97%)
 rename board/{cds/mpc8541cds => freescale/mpc8555cds}/u-boot.lds (97%)

   because apparently the "cds/mpc8541cds/u-boot.lds" copy looked
   a bit more similar to both end results. That said, I *suspect* we just
   have the exact same issue there - the similarity analysis just gave
   identical (or at least very _close_ to identical) similarity points,
   and we do not have any logic to prefer multiple renames over a
   copy/delete there.

   That is a separate patch.

 - When you have identical contents and identical basenames, the actual
   entry that is chosen is still picked fairly "at random" for the first
   one (but the subsequent ones will prefer entries that haven't already
   been used).

   It's not actually really random, in that it actually depends on the
   relative alphabetical order of the files (which in turn will have
   impacted the order that the entries got hashed!), so it gives
   consistent results that can be explained. But I wanted to point it out
   as an issue for when anybody actually does cross-renames.

   In Kumar's case the choice is the right one (and for a single normal
   directory rename it should always be, since the relative alphabetical
   sorting of the files will be identical), and we now get:

 rename board/{cds => freescale}/mpc8541cds/init.S (100%)
 rename board/{cds => freescale}/mpc8548cds/init.S (100%)

   which is the "expected" answer. However, it might still be better to
   change the pedantic "exact same basename" on/off choice into a more
   graduated "how similar are the pathnames" scoring situation, in order
   to be more likely to get the exact rename choice that people *expect*
   to see, rather than other alternatives that may *technically* be
   equally good, but are surprising to a human.

It's also unclear whether we should consider "basenames are equal" or
"have already used this as a source" to be more important. This gives them
equal weight, but I suspect we might want to just multiple the "basenames
are equal" weight by two, or something, to prefer equal basenames even if
that causes a copy/delete pair. I dunno.

Anyway, what I'm just saying in a really long-winded manner is that I
think this is right as-is, but it's not the complete solution, and it may
want some further tweaking in the future.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoAdd "--expire <time>" option to 'git prune'
Johannes Schindelin [Thu, 29 Nov 2007 20:59:55 +0000 (20:59 +0000)]
Add "--expire <time>" option to 'git prune'

Earlier, 'git prune' would prune all loose unreachable objects.
This could be quite dangerous, as the objects could be used in
an ongoing operation.

This patch adds a mode to expire only loose, unreachable objects
which are older than a certain time.  For example, by

git prune --expire 14.days

you can prune only those objects which are loose, unreachable
and older than 14 days (and thus probably outdated).

The implementation uses st.st_mtime rather than st.st_ctime,
because it can be tested better, using 'touch -d <time>' (and
omitting the test when the platform does not support that
command line switch).

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoReplace the word 'update-cache' by 'update-index' everywhere
Johannes Schindelin [Fri, 30 Nov 2007 11:35:23 +0000 (11:35 +0000)]
Replace the word 'update-cache' by 'update-index' everywhere

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoDo check_repository_format() early
Nguyễn Thái Ngọc Duy [Thu, 29 Nov 2007 12:21:39 +0000 (19:21 +0700)]
Do check_repository_format() early

Repository version check is only performed when
setup_git_directory() is called. This makes sure
setup_git_directory_gently() does the check too.

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Acked-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agocvsimport: fix usage of cvsimport.module
Jeff King [Fri, 30 Nov 2007 22:22:12 +0000 (17:22 -0500)]
cvsimport: fix usage of cvsimport.module

There were two problems:

  1. We only look at the config variable if there is no module
     given on the command line. We checked this by comparing
     @ARGV == 0. However, at the time of the comparison, we
     have not yet parsed the dashed options, meaning that
     "git cvsimport" would read the variable but "git
     cvsimport -a" would not. This is fixed by simply moving
     the check after the call to getopt.

  2. If the config variable did not exist, we were adding an
     empty string to @ARGV. The rest of the script, rather
     than barfing for insufficient input, would then try to
     import the module '', leading to rather confusing error
     messages. Based on patch from Emanuele Giaquinta.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoreceive-pack: allow deletion of corrupt refs
Johannes Schindelin [Thu, 29 Nov 2007 01:02:53 +0000 (01:02 +0000)]
receive-pack: allow deletion of corrupt refs

Occasionally, in some setups (*cough* forks on repo.or.cz *cough*) some
refs go stale, e.g. when the forkee rebased and lost some objects needed
by the fork.  The quick & dirty way to deal with those refs is to delete
them and push them again.

However, git-push first would first fetch the current commit name for the
ref, would receive a null sha1 since the ref does not point to a valid
object, then tell receive-pack that it should delete the ref with this
commit name.  delete_ref() would be subsequently be called, and check that
resolve_ref() (which does _not_ check for validity of the object) returns
the same commit name.  Which would fail.

The proper fix is to avoid corrupting repositories, but in the meantime
this is a good fix in any case.

Incidentally, some instances of "cd .." in the test cases were fixed, so
that subsequent test cases run in t/trash/ irrespective of the outcome of
the previous test cases.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoMerge branch 'jk/maint-cvsimport-fix' into maint
Junio C Hamano [Fri, 30 Nov 2007 22:22:54 +0000 (14:22 -0800)]
Merge branch 'jk/maint-cvsimport-fix' into maint

* jk/maint-cvsimport-fix:
  cvsimport: miscellaneous packed-ref fixes
  cvsimport: use rev-parse to support packed refs
  Add basic cvsimport tests

16 years agot7003-filter-branch: Fix test of a failing --msg-filter.
Johannes Sixt [Tue, 27 Nov 2007 12:10:19 +0000 (13:10 +0100)]
t7003-filter-branch: Fix test of a failing --msg-filter.

The test passed for the wrong reason: If the script given to --msg-filter
fails, it is expected that git-filter-branch aborts. But the test forgot
to tell the branch name to rewrite, and so git-filter-branch failed due to
incorrect usage.

Signed-off-by: Johannes Sixt <johannes.sixt@telecom.at>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoMention that git-rm can be an appropriate resolution as well as git-add.
David Symonds [Fri, 23 Nov 2007 13:38:50 +0000 (00:38 +1100)]
Mention that git-rm can be an appropriate resolution as well as git-add.

Especially when using git-cherry-pick, removing files that are unmerged can be
a logical action. This patch merely changes the informative text to be less
confusing.

Signed-off-by: David Symonds <dsymonds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agorevert/cherry-pick: Allow overriding the help text by the calling Porcelain
Wincent Colaiuta [Wed, 28 Nov 2007 08:06:36 +0000 (00:06 -0800)]
revert/cherry-pick: Allow overriding the help text by the calling Porcelain

A Porcelain command that uses cherry-pick or revert may make a commit
out of resolved index itself, in which case telling the user to commit
the result is not appropriate at all.  This allows GIT_CHERRY_PICK_HELP
environment variable to be set by the calling Porcelain in order to
override the built-in help text.

[jc: this is heavily modified from the original but should be equivalent
 in spirit]

Signed-off-by: Junio C Hamano <gitster@pobox.com>