git.git
15 years agoremote: make guess_remote_head() use exact HEAD lookup if it is available
Jeff King [Fri, 27 Feb 2009 19:10:06 +0000 (14:10 -0500)]
remote: make guess_remote_head() use exact HEAD lookup if it is available

Our usual method for determining the ref pointed to by HEAD
is to compare HEAD's sha1 to the sha1 of all refs, trying to
find a unique match.

However, some transports actually get to look at HEAD
directly; we should make use of that information when it is
available.  Currently, only http remotes support this
feature.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Jay Soffian <jaysoffian@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agobuiltin-remote: add set-head subcommand
Jay Soffian [Wed, 25 Feb 2009 08:32:25 +0000 (03:32 -0500)]
builtin-remote: add set-head subcommand

Provide a porcelain command for setting and deleting
$GIT_DIR/remotes/<remote>/HEAD.

While we're at it, document what $GIT_DIR/remotes/<remote>/HEAD is all
about.

Signed-off-by: Jay Soffian <jaysoffian@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agobuiltin-remote: teach show to display remote HEAD
Jay Soffian [Wed, 25 Feb 2009 08:32:24 +0000 (03:32 -0500)]
builtin-remote: teach show to display remote HEAD

This is in preparation for teaching remote how to set
refs/remotes/<remote>/HEAD to match what HEAD is set to at <remote>, but
is useful in its own right.

Signed-off-by: Jay Soffian <jaysoffian@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agobuiltin-remote: fix two inconsistencies in the output of "show <remote>"
Jay Soffian [Wed, 25 Feb 2009 08:32:23 +0000 (03:32 -0500)]
builtin-remote: fix two inconsistencies in the output of "show <remote>"

Remote and stale branches are emitted in alphabetical order, but new and
tracked branches are not. So sort the latter to be consistent with the
former. This also lets us use more efficient string_list_has_string()
instead of unsorted_string_list_has_string().

"show <remote>" prunes symrefs, but "show <remote> -n" does not. Fix the
latter to match the former.

Signed-off-by: Jay Soffian <jaysoffian@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agobuiltin-remote: make get_remote_ref_states() always populate states.tracked
Jay Soffian [Wed, 25 Feb 2009 08:32:22 +0000 (03:32 -0500)]
builtin-remote: make get_remote_ref_states() always populate states.tracked

When not querying the remote, show() was having to populate
states.tracked itself. It makes more sense for get_remote_ref_states()
to do this consistently. Since show() is the only caller of
get_remote_ref_states() with query=0, this change does not affect
other callers.

Signed-off-by: Jay Soffian <jaysoffian@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agobuiltin-remote: rename variables and eliminate redundant function call
Jay Soffian [Wed, 25 Feb 2009 08:32:21 +0000 (03:32 -0500)]
builtin-remote: rename variables and eliminate redundant function call

- The variable name "remote" is used as both a "char *" and as a "struct
  remote *"; this is confusing, so rename the former to remote_name.

- Consistently refer to the refs returned by transport_get_remote_refs()
  as remote_refs.

- There is no need to call "sort_string_list(&branch_list)" as
  branch_list is populated via string_list_insert(), which maintains its
  order.

Signed-off-by: Jay Soffian <jaysoffian@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agobuiltin-remote: remove unused code in get_ref_states
Jay Soffian [Wed, 25 Feb 2009 08:32:20 +0000 (03:32 -0500)]
builtin-remote: remove unused code in get_ref_states

get_ref_states() populates the util pointer of the string_list_item's
that it adds to states->new and states->tracked, but nothing ever uses
the pointer, so we can get rid of the extra code.

Signed-off-by: Jay Soffian <jaysoffian@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agobuiltin-remote: refactor duplicated cleanup code
Jay Soffian [Wed, 25 Feb 2009 08:32:19 +0000 (03:32 -0500)]
builtin-remote: refactor duplicated cleanup code

This patch moves identical lines of code into a cleanup function. The
function has two callers and is about to gain a third.

Also removed a bogus NEEDSWORK comment per Daniel Barkalow:

  Actually, the comment is wrong; "remote" comes from remote_get(),
  which returns things from a cache in remote.c; there could be a
  remote_put() to let the code know that the caller is done with the
  object, but it wouldn't presently do anything.

Signed-off-by: Jay Soffian <jaysoffian@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agostring-list: new for_each_string_list() function
Jay Soffian [Wed, 25 Feb 2009 08:32:18 +0000 (03:32 -0500)]
string-list: new for_each_string_list() function

Add a convenience function for iterating over a string_list's items via
a callback.

Signed-off-by: Jay Soffian <jaysoffian@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoremote: make match_refs() not short-circuit
Jay Soffian [Wed, 25 Feb 2009 08:32:17 +0000 (03:32 -0500)]
remote: make match_refs() not short-circuit

match_refs() returns non-zero if there is an error in
match_explicit_refs(), without handling any remaining pattern ref specs.

Its existing callers exit upon receiving non-zero, so a partial result
is of no consequence to them; however a new caller, builtin-remote, is
interested in the complete result even if there are errors in
match_explicit_refs().

Signed-off-by: Jay Soffian <jaysoffian@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoremote: make match_refs() copy src ref before assigning to peer_ref
Jay Soffian [Wed, 25 Feb 2009 08:32:16 +0000 (03:32 -0500)]
remote: make match_refs() copy src ref before assigning to peer_ref

In some instances, match_refs() sets the peer_ref field of refs in the
dst list such that it points to a ref in the src list. This prevents
callers from freeing both the src and dst lists, as doing so would cause
a double-free since free_refs() frees the peer_ref.

As well, the following configuration causes two refs in the dst list to
have the same peer_ref, which can also lead to a double-free:

  push = refs/heads/master:refs/heads/backup
  push = refs/heads/master:refs/heads/master

Existing callers of match_heads() call it only once and then terminate,
w/o ever bothering to free the src or dst lists, so this is not
currently a problem.

This patch modifies match_refs() to first copy any refs it plucks from
the src list before assigning them as a peer_ref. This allows
builtin-remote, a future caller, to free the src and dst lists.

Signed-off-by: Jay Soffian <jaysoffian@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoremote: let guess_remote_head() optionally return all matches
Jay Soffian [Fri, 27 Feb 2009 19:10:05 +0000 (14:10 -0500)]
remote: let guess_remote_head() optionally return all matches

Determining HEAD is ambiguous since it is done by comparing SHA1s.

In the case of multiple matches we return refs/heads/master if it
matches, else we return the first match we encounter. builtin-remote
needs all matches returned to it, so add a flag for it to request such.

To be simple and consistent, the return value is now a copy (including
peer_ref) of the matching refs.

Originally contributed by Jeff King along with the prior commit as a
single patch.

Signed-off-by: Jay Soffian <jaysoffian@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoremote: make copy_ref() perform a deep copy
Jay Soffian [Fri, 27 Feb 2009 19:10:04 +0000 (14:10 -0500)]
remote: make copy_ref() perform a deep copy

To ensure that copied refs can always be freed w/o causing a
double-free, make copy_ref() perform a deep copy.

Also have copy_ref() return NULL if asked to copy NULL to simplify
things for the caller.

Background: currently copy_ref() performs a shallow copy. This is fine
for current callers who never free the result and/or only copy refs
which contain NULL pointers. But copy_ref() is about to gain a new
caller (guess_remote_head()) which copies refs where peer_ref is not
NULL and the caller of guess_remote_head() will want to free the result.

Signed-off-by: Jay Soffian <jaysoffian@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoremote: simplify guess_remote_head()
Jay Soffian [Wed, 25 Feb 2009 08:32:14 +0000 (03:32 -0500)]
remote: simplify guess_remote_head()

This function had complications which made it hard to extend.

- It used to do two things: find the HEAD ref, and then find a
  matching ref, optionally returning the former via assignment to a
  passed-in pointer. Since finding HEAD is a one-liner, just have a
  caller do it themselves and pass it as an argument.

- It used to manually search through the ref list for
  refs/heads/master; this can be a one-line call to
  find_ref_by_name.

Originally contributed by Jeff King along with the next commit as a
single patch.

Signed-off-by: Jay Soffian <jaysoffian@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agomove locate_head() to remote.c
Jay Soffian [Wed, 25 Feb 2009 08:32:13 +0000 (03:32 -0500)]
move locate_head() to remote.c

Move locate_head() to remote.c and rename it to guess_remote_head() to
more accurately reflect what it does. This is in preparation for being
able to call it from builtin-remote.c

Signed-off-by: Jay Soffian <jaysoffian@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agomove duplicated ref_newer() to remote.c
Jay Soffian [Wed, 25 Feb 2009 08:32:12 +0000 (03:32 -0500)]
move duplicated ref_newer() to remote.c

ref_newer() appears to have been copied from builtin-send-pack.c to
http-push.c via cut and paste. This patch moves the function and its
helper unmark_and_free() to remote.c. There was a slight difference
between the two implementations, one used TMP_MARK for the mark, the
other used 1. Per Jeff King, I went with TMP_MARK as more correct.

This is in preparation for being able to call it from builtin-remote.c

Signed-off-by: Jay Soffian <jaysoffian@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agomove duplicated get_local_heads() to remote.c
Jay Soffian [Wed, 25 Feb 2009 08:32:11 +0000 (03:32 -0500)]
move duplicated get_local_heads() to remote.c

get_local_heads() appears to have been copied from builtin-send-pack.c
to http-push.c via cut and paste. This patch moves the function and its
helper one_local_ref() to remote.c.

The two copies of one_local_ref() were not identical. I used the more
recent version from builtin-send-pack.c after confirming with Jeff King
that it was an oversight that commit 30affa1e did not update both
copies.

This is in preparation for being able to call it from builtin-remote.c

Signed-off-by: Jay Soffian <jaysoffian@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agorefactor find_ref_by_name() to accept const list
Jeff King [Wed, 25 Feb 2009 08:32:10 +0000 (03:32 -0500)]
refactor find_ref_by_name() to accept const list

Since it doesn't actually touch its argument, this makes
sense.

However, we still want to return a non-const version (which
requires a cast) so that this:

  struct ref *a, *b;
  a = find_ref_by_name(b);

works. Unfortunately, you can also silently strip the const
from a variable:

  struct ref *a;
  const struct ref *b;
  a = find_ref_by_name(b);

This is a classic C const problem because there is no way to
say "return the type with the same constness that was passed
to us"; we provide the same semantics as standard library
functions like strchr.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Jay Soffian <jaysoffian@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoadd basic http clone/fetch tests
Jeff King [Wed, 25 Feb 2009 08:32:09 +0000 (03:32 -0500)]
add basic http clone/fetch tests

This was mostly being tested implicitly by the "http push"
tests. But making a separate test script means that:

  - we will run fetch tests even when http pushing support
    is not built

  - when there are failures on fetching, they are easier to
    see and isolate, as they are not in the middle of push
    tests

This script defaults to running the webserver on port 5550,
and puts the original t5540 on port 5540, so that the two
can be run simultaneously without conflict (but both still
respect an externally set LIB_HTTPD_PORT).

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Jay Soffian <jaysoffian@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agotest scripts: refactor start_httpd helper
Jeff King [Wed, 25 Feb 2009 08:32:08 +0000 (03:32 -0500)]
test scripts: refactor start_httpd helper

There are some redirects and some error checking that need
to be done by the caller; let's move both into the
start_httpd function so that all callers don't have to
repeat them (there is only one caller now, but another will
follow in this series).

This doesn't violate any assumptions that aren't already
being made by lib-httpd, which is happy to say "skipping"
and call test_done for a number of other cases.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Jay Soffian <jaysoffian@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoGIT 1.6.2-rc2 v1.6.2-rc2
Junio C Hamano [Wed, 25 Feb 2009 22:50:52 +0000 (14:50 -0800)]
GIT 1.6.2-rc2

Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoMerge branch 'jc/maint-1.6.0-pack-directory'
Junio C Hamano [Wed, 25 Feb 2009 22:48:30 +0000 (14:48 -0800)]
Merge branch 'jc/maint-1.6.0-pack-directory'

* jc/maint-1.6.0-pack-directory:
  Make sure objects/pack exists before creating a new pack

15 years agoMake sure objects/pack exists before creating a new pack
Junio C Hamano [Wed, 25 Feb 2009 07:11:29 +0000 (23:11 -0800)]
Make sure objects/pack exists before creating a new pack

In a repository created with git older than f49fb35 (git-init-db: create
"pack" subdirectory under objects, 2005-06-27), objects/pack/ directory is
not created upon initialization.  It was Ok because subdirectories are
created as needed inside directories init-db creates, and back then,
packfiles were recent invention.

After the said commit, new codepaths started relying on the presense of
objects/pack/ directory in the repository.  This was exacerbated with
8b4eb6b (Do not perform cross-directory renames when creating packs,
2008-09-22) that moved the location temporary pack files are created from
objects/ directory to objects/pack/ directory, because moving temporary to
the final location was done carefully with lazy leading directory creation.

Many packfile related operations in such an old repository can fail
mysteriously because of this.

This commit introduces two helper functions to make things work better.

 - odb_mkstemp() is a specialized version of mkstemp() to refactor the
   code and teach it to create leading directories as needed;

 - odb_pack_keep() refactors the code to create a ".keep" file while
   create leading directories as needed.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoAllow HTTP tests to run on Darwin
Jay Soffian [Wed, 25 Feb 2009 08:28:15 +0000 (03:28 -0500)]
Allow HTTP tests to run on Darwin

This patch allows the HTTP tests to run on OS X 10.5. It is not
sufficient to be able to pass in LIB_HTTPD_PATH and
LIB_HTTPD_MODULE_PATH alone, as the apache.conf also needs a couple
tweaks.

These changes are put into an <IfDefine> to keep them Darwin specific,
but this means lib-httpd.sh needs to be modified to pass -DDarwin to
apache when running on Darwin. As long as we're making this change to
lib-httpd.sh, we may as well set LIB_HTTPD_PATH and
LIB_HTTPD_MODULE_PATH to appropriate default values for the platform.

Note that we now pass HTTPD_PARA to apache at shutdown as well.
Otherwise apache will emit a harmless, but noisy warning that LogFormat
is an unknown directive.

Signed-off-by: Jay Soffian <jaysoffian@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoFix typo in contrib/examples/git-svnimport.txt
Michael J Gruber [Wed, 25 Feb 2009 14:05:17 +0000 (15:05 +0100)]
Fix typo in contrib/examples/git-svnimport.txt

Signed-off-by: Michael J Gruber <git@drmicha.warpmail.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agogitattributes.txt: Path matching rules are explained in gitignore.txt
Johannes Sixt [Wed, 25 Feb 2009 07:54:42 +0000 (08:54 +0100)]
gitattributes.txt: Path matching rules are explained in gitignore.txt

The rules how the patterns are matched against path names are the same
for .gitattribute and .gitignore files.

This also replace the notion "glob pattern" by "pattern" because
gitignore.txt talks about "glob" only in some contexts where the pattern
is mentioned.

Signed-off-by: Johannes Sixt <j6t@kdbg.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agosha1_file.c: fix typo
Felipe Contreras [Tue, 24 Feb 2009 21:59:05 +0000 (23:59 +0200)]
sha1_file.c: fix typo

it's != its

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agogit add: trivial codestyle cleanup
Felipe Contreras [Tue, 24 Feb 2009 21:59:03 +0000 (23:59 +0200)]
git add: trivial codestyle cleanup

Global static variables don't need to be initialized to 0/NULL.

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoREADME: fix path to "gitcvs-migration.txt" and be more consistent
Christian Couder [Tue, 24 Feb 2009 20:16:37 +0000 (21:16 +0100)]
README: fix path to "gitcvs-migration.txt" and be more consistent

README suggested to look at "Documentation/gittutorial.txt" for the
tutorial and to use "man git-commandname" for documentation of each
command.

This was not consistent because the tutorial can also be available with
"man gittutorial" once git is installed, and the documentation for each
command can be available at "Documentation/git-commandname.txt" before
installing git.

This patch tries to make the description more consistent.  It also fixes
the path to the cvs-migration documentation that changed from
"Documentation/cvs-migration.txt" to "Documentation/gitcvs-migration.txt".

Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agotrace: Fixed a minor typo in an error message.
Allan Caffee [Wed, 25 Feb 2009 01:22:20 +0000 (20:22 -0500)]
trace: Fixed a minor typo in an error message.

Signed-off-by: Allan Caffee <allan.caffee@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoDocs: Expand explanation of the use of + in git push refspecs.
Marc Branchaud [Thu, 19 Feb 2009 17:39:47 +0000 (12:39 -0500)]
Docs: Expand explanation of the use of + in git push refspecs.

Signed-off-by: Marc Branchaud <marcnarc@xiplink.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agogit-quiltimport: preserve standard input to be able to read user input
Gerrit Pape [Tue, 24 Feb 2009 09:00:06 +0000 (09:00 +0000)]
git-quiltimport: preserve standard input to be able to read user input

When run without --author and it fails to determine an author, git
quiltimport tries `read patch_author` to get user input, but standard
input has been redirected to the patch series file.  This commit lets
quiltimport read the series file through file descriptor 3 so that the
standard input is preserved.

Reported by Uwe Kleine-König through http://bugs.debian.org/515910

Signed-off-by: Gerrit Pape <pape@smarden.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoInstall builtins with the user and group of the installing personality
Gerrit Pape [Tue, 24 Feb 2009 08:58:16 +0000 (08:58 +0000)]
Install builtins with the user and group of the installing personality

If 'make install' was run with sufficient privileges, then the installed
builtins in gitexecdir, which are either hardlinked, symlinked, or copied,
would receive the user and group of whoever built git.  With this commit
the initial hardlink or copy is done from the installation tree and not
the build tree to fix this.

Signed-off-by: Gerrit Pape <pape@smarden.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoMerge git://git.bogomips.org/git-svn
Junio C Hamano [Wed, 25 Feb 2009 05:13:32 +0000 (21:13 -0800)]
Merge git://git.bogomips.org/git-svn

* git://git.bogomips.org/git-svn:
  git-svn fix to avoid using strftime %z

15 years agoConvert git-* invocations to "git *" in the svnimport example.
Abhijit Menon-Sen [Wed, 25 Feb 2009 03:03:14 +0000 (08:33 +0530)]
Convert git-* invocations to "git *" in the svnimport example.

After these changes, git-svnimport worked fine for me.

Signed-off-by: Abhijit Menon-Sen <ams@toroid.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agogit-svn fix to avoid using strftime %z
Ben Walton [Tue, 24 Feb 2009 19:44:49 +0000 (14:44 -0500)]
git-svn fix to avoid using strftime %z

%z isn't available on all platforms in the date formatting
routines.  Provide a workalike capability that should be
more portable.

Signed-off-by: Ben Walton <bwalton@artsci.utoronto.ca>
Acked-by: Eric Wong <normalperson@yhbt.net>
15 years agoMerge git://git.bogomips.org/git-svn
Junio C Hamano [Tue, 24 Feb 2009 03:14:13 +0000 (19:14 -0800)]
Merge git://git.bogomips.org/git-svn

* git://git.bogomips.org/git-svn:
  git-svn: read the dcommit url from the config file on a per remote basis
  git-svn: fix delete+add branch tracking with empty files
  git-svn: Create leading directories in create-ignore

15 years agogit-p4: avoid syncing duplicate changes
Pete Wyckoff [Wed, 18 Feb 2009 18:12:14 +0000 (13:12 -0500)]
git-p4: avoid syncing duplicate changes

When a particular changeset affects multiple depot paths, it
will appear multiple times in the output of "p4 changes".
Filter out the duplicates to avoid the extra empty commits that
this otherwise would create.

Signed-off-by: Pete Wyckoff <pw@padd.com>
Acked-by: Simon Hausmann <simon@lst.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agogit-svn: read the dcommit url from the config file on a per remote basis
Peter Oberndorfer [Mon, 23 Feb 2009 11:02:53 +0000 (12:02 +0100)]
git-svn: read the dcommit url from the config file on a per remote basis

The commit url for dcommit is determined in the following order:
commandline option --commit-url
svn.commiturl
svn-remote.<name>.commiturl
svn-remote.<name>.url

Signed-off-by: Peter Oberndorfer <kumbayo84@arcor.de>
Acked-by: Eric Wong <normalperson@yhbt.net>
15 years agogit-svn: fix delete+add branch tracking with empty files
Eric Wong [Mon, 23 Feb 2009 04:25:00 +0000 (20:25 -0800)]
git-svn: fix delete+add branch tracking with empty files

Original bug report and test case by Björn Steinbrink.

Björn Steinbrink <B.Steinbrink@gmx.de> wrote:
> Hi Eric,
>
> seems that the empty symlink stuff gets confused about which revision to
> use when looking for the parent's file.
>
> r3 = f1a6fcf6b0a1c4a373d0b2b65a3d70700084f361 (tags/1.0.1)
> Found possible branch point: file:///home/doener/h/svn/tags/1.0 => file:///home/doener/h/svn/branches/1.0, 4
> Found branch parent: (1.0) 63ae640ba01014ecbb3df590999ed1fa5914545b
> Following parent with do_switch
> Successfully followed parent
> r5 = 26fcfef5bcced97ab74faf1af7341a2ae0d272aa (1.0)
> Found possible branch point: file:///home/doener/h/svn/branches/1.0 => file:///home/doener/h/svn/tags/1.0.1, 5
> Found branch parent: (tags/1.0.1) 26fcfef5bcced97ab74faf1af7341a2ae0d272aa
> Following parent with do_switch
> Scanning for empty symlinks, this may take a while if you have many empty files
> You may disable this with `git config svn.brokenSymlinkWorkaround false'.
> This may be done in a different terminal without restarting git svn
> Filesystem has no item: File not found: revision 3, path '/branches/1.0/file' at /usr/local/libexec/git-core/git-svn line 3318
>
> Note how it tries to look at revision 3 instead of revision 5 (which it
> correctly detected as the parent). The import succeeds when
> svn.brokenSymlinkWorkaround is set to false. Testcase below.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
15 years agogit-svn: Create leading directories in create-ignore
Brian Gernhardt [Thu, 19 Feb 2009 18:08:04 +0000 (13:08 -0500)]
git-svn: Create leading directories in create-ignore

Since SVN tracks empty directories and git does not, we can not assume
that the directory exists when creating .gitignore files.

Signed-off-by: Brian Gernhardt <benji@silverinsanity.com>
Acked-by: Eric Wong <normalperson@yhbt.net>
15 years agoMerge branch 'for-junio' of git://source.winehq.org/~julliard/git/git
Junio C Hamano [Sat, 21 Feb 2009 18:38:04 +0000 (10:38 -0800)]
Merge branch 'for-junio' of git://source.winehq.org/~julliard/git/git

* 'for-junio' of git://source.winehq.org/~julliard/git/git:
  Add a README in the contrib/emacs directory.
  git.el: Improve the confirmation message on remove and revert.
  git.el: Make sure that file lists are sorted as they are created.

15 years agoAdd a README in the contrib/emacs directory.
Alexandre Julliard [Mon, 16 Feb 2009 10:40:29 +0000 (11:40 +0100)]
Add a README in the contrib/emacs directory.

Signed-off-by: Alexandre Julliard <julliard@winehq.org>
15 years agogit.el: Improve the confirmation message on remove and revert.
Alexandre Julliard [Mon, 16 Feb 2009 10:40:08 +0000 (11:40 +0100)]
git.el: Improve the confirmation message on remove and revert.

If there's only one file, print its name instead of just "1 file".

Signed-off-by: Alexandre Julliard <julliard@winehq.org>
15 years agogit.el: Make sure that file lists are sorted as they are created.
Alexandre Julliard [Mon, 16 Feb 2009 10:39:11 +0000 (11:39 +0100)]
git.el: Make sure that file lists are sorted as they are created.

This avoids a possibly redundant sort in git-update-status-files and
git-status-filenames-map, and allows callers to continue using the
list without having to copy it.

It also fixes the confusing success messages reported by Brent
Goodrick.

Signed-off-by: Alexandre Julliard <julliard@winehq.org>
15 years agoSupport 'raw' date format
Linus Torvalds [Fri, 20 Feb 2009 22:15:22 +0000 (14:15 -0800)]
Support 'raw' date format

Talking about --date, one thing I wanted for the 1234567890 date was to
get things in the raw format. Sure, you get them with --pretty=raw, but it
felt a bit sad that you couldn't just ask for the date in raw format.

So here's a throw-away patch (meaning: I won't be re-sending it, because I
really don't think it's a big deal) to add "--date=raw". It just prints
out the internal raw git format - seconds since epoch plus timezone (put
another way: 'date +"%s %z"' format)

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoMerge branch 'maint'
Junio C Hamano [Fri, 20 Feb 2009 07:44:07 +0000 (23:44 -0800)]
Merge branch 'maint'

* maint:
  More friendly message when locking the index fails.
  Document git blame --reverse.
  Documentation: Note file formats send-email accepts

15 years agoMore friendly message when locking the index fails.
Matthieu Moy [Thu, 19 Feb 2009 12:54:18 +0000 (13:54 +0100)]
More friendly message when locking the index fails.

Just saying that index.lock exists doesn't tell the user _what_ to do
to fix the problem. We should give an indication that it's normally
safe to delete index.lock after making sure git isn't running here.

Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoDocument git blame --reverse.
Matthieu Moy [Thu, 19 Feb 2009 12:34:48 +0000 (13:34 +0100)]
Document git blame --reverse.

This was introduced in 85af7929ee125385c2771fa4eaccfa2f29dc63c9 but
not documented outside the commit message.

Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agogitweb: Hyperlink multiple git hashes on the same commit message line
Marcel M. Cary [Wed, 18 Feb 2009 03:00:43 +0000 (19:00 -0800)]
gitweb: Hyperlink multiple git hashes on the same commit message line

The current implementation only hyperlinks the first hash on
a given line of the commit message.  It seems sensible to
highlight all of them if there are multiple, and it seems
plausible that there would be multiple even with a tidy line
length limit, because they can be abbreviated as short as 8
characters.

Benchmark:

I wanted to make sure that using the 'e' switch to the Perl regex
wasn't going to kill performance, since this is called once per commit
message line displayed.

In all three A/B scenarios I tried, the A and B yielded the same
results within 2%, where A is the version of code before this patch
and B is the version after.

1: View a commit message containing the last 1000 commit hashes
2: View a commit message containing 1000 lines of 40 dots to avoid
   hyperlinking at the same message length
3: View a short merge commit message with a few lines of text and
   no hashes

All were run in CGI mode on my sub-production hardware on a recent
clone of git.git.  Numbers are the average of 10 reqests per second
with the first request discarded, since I expect this change to affect
primarily CPU usage.  Measured with ApacheBench.

Note that the web page rendered was the same; while the new code
supports multiple hashes per line, there was at most one per line.

The primary purpose of scenarios 2 and 3 were to verify that the
addition of 1000 commit messages had an impact on how much of the time
was spent rendering commit messages.  They were all within 2% of 0.80
requests per second (much faster).

So I think the patch has no noticeable effect on performance.

Signed-off-by: Marcel M. Cary <marcel@oak.homeunix.org>
Acked-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agosystem_path(): simplify using strip_path_suffix(), and add suffix "git"
Johannes Schindelin [Thu, 19 Feb 2009 19:10:53 +0000 (20:10 +0100)]
system_path(): simplify using strip_path_suffix(), and add suffix "git"

At least for the author of this patch, the logic in system_path() was
too hard to understand.  Using the function strip_path_suffix() documents
the idea of the code better.

The real change is to add the suffix "git", so that a runtime prefix will
be computed correctly even when the executable was called in /git/ as is
the case in msysGit (Windows insists to search the current directory
before the PATH when looking for an executable).

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Acked-by: Johannes Sixt <j6t@kdbg.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoIntroduce the function strip_path_suffix()
Johannes Schindelin [Thu, 19 Feb 2009 19:10:49 +0000 (20:10 +0100)]
Introduce the function strip_path_suffix()

The function strip_path_suffix() will try to strip a given suffix from
a given path.  The suffix must start at a directory boundary (i.e. "core"
is not a path suffix of "libexec/git-core", but "git-core" is).

Arbitrary runs of directory separators ("slashes") are assumed identical.

Example:

strip_path_suffix("C:\\msysgit/\\libexec\\git-core",
"libexec///git-core", &prefix)

will set prefix to "C:\\msysgit" and return 0.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Acked-by: Johannes Sixt <j6t@kdbg.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoDocumentation: Note file formats send-email accepts
Todd Zullinger [Thu, 19 Feb 2009 03:51:06 +0000 (22:51 -0500)]
Documentation: Note file formats send-email accepts

Signed-off-by: Todd Zullinger <tmz@pobox.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoMerge branch 'maint'
Junio C Hamano [Wed, 18 Feb 2009 19:31:52 +0000 (11:31 -0800)]
Merge branch 'maint'

* maint:
  tests: fix "export var=val"
  Skip timestamp differences for diff --no-index
  Documentation/git-push: --all, --mirror, --tags can not be combined

15 years agotests: fix "export var=val"
Junio C Hamano [Wed, 18 Feb 2009 19:17:27 +0000 (11:17 -0800)]
tests: fix "export var=val"

Some shells do not like "export var=val"; the right way to write
it is to do an assignment and then export just the variable name.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agofilter-branch -d: Export GIT_DIR earlier
Lars Noschinski [Wed, 18 Feb 2009 08:35:36 +0000 (09:35 +0100)]
filter-branch -d: Export GIT_DIR earlier

The improved error handling catches a bug in filter-branch when using
-d pointing to a path outside any git repository:

$ git filter-branch -d /tmp/foo master
fatal: Not a git repository (or any of the parent directories): .git

This error message comes from git for-each-ref in line 224. GIT_DIR is
set correctly by git-sh-setup (to the foo.git repository), but not
exported (yet).

Signed-off-by: Lars Noschinski <lars@public.noschinski.de>
Acked-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agodisallow providing multiple upstream branches to rebase, pull --rebase
Jay Soffian [Wed, 18 Feb 2009 13:44:02 +0000 (08:44 -0500)]
disallow providing multiple upstream branches to rebase, pull --rebase

It does not make sense to provide multiple upstream branches to either
git pull --rebase, or to git rebase, so disallow both.

Signed-off-by: Jay Soffian <jaysoffian@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoSkip timestamp differences for diff --no-index
Michael Spang [Wed, 18 Feb 2009 06:48:06 +0000 (01:48 -0500)]
Skip timestamp differences for diff --no-index

We display empty diffs for files whose timestamps have changed.
Usually, refreshing the index makes those empty diffs go away.
However, when not using the index they are not very useful and
there is no option to suppress them.

This forces on the skip_stat_unmatch option for diff --no-index,
suppressing any empty diffs. This option is also used for diffs
against the index when "diff.autorefreshindex" is set, but that
option does not apply to diff --no-index.

Signed-off-by: Michael Spang <mspang@uwaterloo.ca>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agogit-svn: fix parsing of timestamp obtained from svn
Junio C Hamano [Wed, 18 Feb 2009 18:48:01 +0000 (10:48 -0800)]
git-svn: fix parsing of timestamp obtained from svn

Ward Wouts reports that git-svn barfed like this:

    Unable to parse date: 2004-03-09T09:44:33.Z at /usr/bin/git-svn line 3995

The parse_svn_date sub expects there always are one or more digits after
the decimal point to record fractional seconds, but this example does not
and results in a failure like this.

The fix is based on the original fix by the reporter, further cleaned up.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
Acked-by: Eric Wong <normalperson@yhbt.net>
15 years agogitweb: Fix warnings with override permitted but no repo override
Marcel M. Cary [Wed, 18 Feb 2009 13:09:41 +0000 (14:09 +0100)]
gitweb: Fix warnings with override permitted but no repo override

When a feature like "blame" is permitted to be overridden in the
repository configuration but it is not actually set in the repository,
a warning is emitted due to the undefined value of the repository
configuration, even though it's a perfectly normal condition.
Emitting warning is grounds for test failure in the gitweb test
script.

This error was caused by rewrite of git_get_project_config from using
"git config [<type>] <name>" for each individual configuration
variable checked to parsing "git config --list --null" output in
commit b201927 (gitweb: Read repo config using 'git config -z -l').
Earlier version of git_get_project_config was returning empty string
if variable do not exist in config; newer version is meant to return
undef in this case, therefore change in feature_bool was needed.

Additionally config_to_* subroutines were meant to be invoked only if
configuration variable exists; therefore we added early return to
git_get_project_config: it now returns no value if variable does not
exists in config.  Otherwise config_to_* subroutines (config_to_bool
in paryicular) wouldn't be able to distinguish between the case where
variable does not exist and the case where variable doesn't have value
(the "[section] noval" case, which evaluates to true for boolean).

While at it fix bug in config_to_bool, where checking if $val is
defined (if config variable has value) was done _after_ stripping
leading and trailing whitespace, which lead to 'Use of uninitialized
value' warning.

Add test case for features overridable but not overriden in repo
config, and case for no value boolean configuration variable.

Signed-off-by: Marcel M. Cary <marcel@oak.homeunix.org>
Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoDocumentation/git-push: --all, --mirror, --tags can not be combined
Gerrit Pape [Tue, 17 Feb 2009 09:25:02 +0000 (09:25 +0000)]
Documentation/git-push: --all, --mirror, --tags can not be combined

While b259f09 made git-push output a better error message for 'git-push
--all --tags', this commit fixes the synopsis in the documentation.

Inconsistency spotted and fix suggested by Jari Aalto through
 http://bugs.debian.org/502567

Signed-off-by: Gerrit Pape <pape@smarden.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agobash completion: only show 'log --merge' if merging
Thomas Rast [Mon, 16 Feb 2009 16:34:57 +0000 (17:34 +0100)]
bash completion: only show 'log --merge' if merging

The gitk completion only shows --merge if MERGE_HEAD is present.
Do it the same way for git-log completion.

Signed-off-by: Thomas Rast <trast@student.ethz.ch>
Acked-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agobash completion: refactor common log, shortlog and gitk options
Thomas Rast [Mon, 16 Feb 2009 16:34:56 +0000 (17:34 +0100)]
bash completion: refactor common log, shortlog and gitk options

Refactor options that are useful for more than one of them into a
variable used by the relevant completions.  This has the effect of
adding the following options to git-log:

  --branches --tags --remotes --first-parent --dense --sparse
  --simplify-merges --simplify-by-decoration --first-parent
  --no-merges

The following to git-shortlog:

  --branches --tags --remotes --first-parent

And the following to gitk:

  --branches --tags --remotes --first-parent --no-merges --max-count=
  --max-age= --since= --after= --min-age= --until= --before= --dense
  --sparse --full-history --simplify-merges --simplify-by-decoration
  --left-right

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 agogitweb: fix wrong base URL when non-root DirectoryIndex
Giuseppe Bilotta [Sun, 15 Feb 2009 09:18:36 +0000 (10:18 +0100)]
gitweb: fix wrong base URL when non-root DirectoryIndex

CGI::url() has some issues when rebuilding the script URL if the script
is a DirectoryIndex.

One of these issue is the inability to strip PATH_INFO, which is why
we had to do it ourselves.

Another issue is that the resulting URL cannot be used for the <base>
tag: it works if we're the DirectoryIndex at the root level, but not
otherwise.

We fix this by building the proper base URL ourselves, and improve the
comment about the need to strip PATH_INFO manually while we're at it.

Additionally t/t9500-gitweb-standalone-no-errors.sh had to be modified
to set SCRIPT_NAME variable (CGI standard states that it MUST be set,
and now gitweb uses it if PATH_INFO is not empty, as is the case for
some of tests in t9500).

Signed-off-by: Giuseppe Bilotta <giuseppe.bilotta@gmail.com>
Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agobash: update 'git svn' options
SZEDER Gábor [Sat, 14 Feb 2009 16:21:53 +0000 (17:21 +0100)]
bash: update 'git svn' options

'git svn' got some new subcommands and otions in the last couple of
months.  This patch adds completion support for them.

In particular:

  * 'fetch', 'clone', etc.: '--ignore-paths='
  * 'init' and 'clone': '--prefix=', '--use-log-author',
                        '--add-author-from'
  * 'dcommit': '--commit-url', '--revision'
  * 'log': '--color'
  * 'rebase': '--dry-run'
  * 'branch', 'tag', 'blame', 'migrate' subcommands and their options

Signed-off-by: SZEDER Gábor <szeder@ira.uka.de>
Acked-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agobash: add missing 'git merge' options
SZEDER Gábor [Sun, 15 Feb 2009 13:25:11 +0000 (14:25 +0100)]
bash: add missing 'git merge' options

Namely: '--commit', '--stat', '--no-squash', '--ff', '--no-ff'.

One might wonder why add options that specify the default behaviour
anyway (e.g. '--commit', '--no-squash', etc.).  Users can override the
default with config options (e.g. 'branch.<name>.mergeoptions',
'merge.log'), but sometimes might still need the default behaviour.

Signed-off-by: SZEDER Gábor <szeder@ira.uka.de>
Acked-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agogit-svn: Fix for rewriteRoot URL containing username. v1.6.2-rc1
Dévai Tamás [Wed, 11 Feb 2009 23:14:02 +0000 (00:14 +0100)]
git-svn: Fix for rewriteRoot URL containing username.

If the new svn root URL given with the svn-remote.<repo>.rewriteRoot config option
(or by the --rewrite-root option to 'git svn init') contains a username
(such as 'svn+ssh://username@example.com/repo'), find_by_url() cannot find
the repository URL, because the URL contained in the commit message does have
the username removed.

Signed-off-by: Dévai Tamás <devait@mailbox.sk>
Acked-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agobuiltin-receive-pack.c: fix compiler warnings about format string
René Scharfe [Sun, 15 Feb 2009 18:18:58 +0000 (19:18 +0100)]
builtin-receive-pack.c: fix compiler warnings about format string

While all of the strings passed to warning() are, in fact, literals, the
compiler doesn't recognize them as such because it doesn't see through
the loop used to iterate over them:

   builtin-receive-pack.c: In function 'warn_unconfigured_deny':
   builtin-receive-pack.c:247: warning: format not a string literal and no format arguments
   builtin-receive-pack.c: In function 'warn_unconfigured_deny_delete_current':
   builtin-receive-pack.c:273: warning: format not a string literal and no format arguments

Calm the compiler by adding easily recognizable format string literals.

Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoRelNotes Update
Junio C Hamano [Sun, 15 Feb 2009 08:15:52 +0000 (00:15 -0800)]
RelNotes Update

Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoMerge branch 'mc/setup-cd-p'
Junio C Hamano [Sun, 15 Feb 2009 09:44:58 +0000 (01:44 -0800)]
Merge branch 'mc/setup-cd-p'

* mc/setup-cd-p:
  git-sh-setup: Use "cd" option, not /bin/pwd, for symlinked work tree

15 years agoMerge branch 'ff/submodule-no-fetch'
Junio C Hamano [Sun, 15 Feb 2009 09:44:20 +0000 (01:44 -0800)]
Merge branch 'ff/submodule-no-fetch'

* ff/submodule-no-fetch:
  submodule: add --no-fetch parameter to update command

15 years agoMerge branch 'ms/mailmap'
Junio C Hamano [Sun, 15 Feb 2009 09:44:15 +0000 (01:44 -0800)]
Merge branch 'ms/mailmap'

* ms/mailmap:
  Move mailmap documentation into separate file
  Change current mailmap usage to do matching on both name and email of author/committer.
  Add map_user() and clear_mailmap() to mailmap
  Add find_insert_index, insert_at_index and clear_func functions to string_list
  Add mailmap.file as configurational option for mailmap location

15 years agoMerge branch 'jn/gitweb-committag'
Junio C Hamano [Sun, 15 Feb 2009 09:44:11 +0000 (01:44 -0800)]
Merge branch 'jn/gitweb-committag'

* jn/gitweb-committag:
  gitweb: Better regexp for SHA-1 committag match

15 years agoMerge branch 'rc/http-push'
Junio C Hamano [Sun, 15 Feb 2009 09:43:57 +0000 (01:43 -0800)]
Merge branch 'rc/http-push'

* rc/http-push:
  use a hash of the lock token as the suffix for PUT/MOVE

15 years agouse a hash of the lock token as the suffix for PUT/MOVE
Tay Ray Chuan [Sat, 14 Feb 2009 09:52:14 +0000 (17:52 +0800)]
use a hash of the lock token as the suffix for PUT/MOVE

After 753bc91 ("Remove the requirement opaquelocktoken uri scheme"),
lock tokens are in the URI forms in which they are received from the
server, eg. 'opaquelocktoken:', 'urn:uuid:'.

However, "start_put" (and consequently "start_move"), which attempts to
create a unique temporary file using the UUID of the lock token,
inadvertently uses the lock token in its URI form. These file
operations on the server may not be successful (specifically, in
Windows), due to the colon ':' character from the URI form of the lock
token in the file path.

This patch uses a hash of the lock token instead, guaranteeing only
"safe" characters (a-f, 0-9) are used in the file path.

The token's hash is generated when the lock token is received from the
server in handle_new_lock_ctx, minimizing the number of times of
hashing.

Signed-off-by: Tay Ray Chuan <rctay89@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoMerge branch 'js/gc-prune'
Junio C Hamano [Sun, 15 Feb 2009 08:05:11 +0000 (00:05 -0800)]
Merge branch 'js/gc-prune'

* js/gc-prune:
  gc: make --prune useful again by accepting an optional parameter

15 years agoMerge branch 'tr/abbrev-commit-no-ellipses'
Junio C Hamano [Sun, 15 Feb 2009 08:03:43 +0000 (00:03 -0800)]
Merge branch 'tr/abbrev-commit-no-ellipses'

* tr/abbrev-commit-no-ellipses:
  log: do not print ellipses with --abbrev-commit

15 years agoMerge branch 'jc/branch-previous'
Junio C Hamano [Sun, 15 Feb 2009 08:03:29 +0000 (00:03 -0800)]
Merge branch 'jc/branch-previous'

* jc/branch-previous:
  Teach @{-1} to git merge
  Teach the "@{-1} syntax to "git branch"

15 years agobash: fix misspelled 'git svn' option
SZEDER Gábor [Sat, 14 Feb 2009 16:21:52 +0000 (17:21 +0100)]
bash: fix misspelled 'git svn' option

'--user-log-author' -> '--use-log-author'

Signed-off-by: SZEDER Gábor <szeder@ira.uka.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agot1500: more 'git rev-parse --git-dir' tests
SZEDER Gábor [Sat, 14 Feb 2009 16:16:29 +0000 (17:16 +0100)]
t1500: more 'git rev-parse --git-dir' tests

Extend t1500 with tests of 'git rev-parse --git-dir' when invoked from
other directories of the repository or the work tree.

Signed-off-by: SZEDER Gábor <szeder@ira.uka.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoMove 'rev-parse --git-dir' test to t1500
SZEDER Gábor [Sat, 14 Feb 2009 16:16:28 +0000 (17:16 +0100)]
Move 'rev-parse --git-dir' test to t1500

Commit 72183cb2 (Fix gitdir detection when in subdir of
gitdir, 2009-01-16) added a test to 't1501-worktree' to check the
behaviour of 'git rev-parse --git-dir' in a special case.  However,
t1501 is about testing separate work tree setups, and not about basic
'rev-parse' functionality, which is tested in t1500-rev-parse.
Therefore, this patch moves that test to t1500.

Signed-off-by: SZEDER Gábor <szeder@ira.uka.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoDocumentation: pruning recipe for destructive filter-branch
Thomas Rast [Sat, 14 Feb 2009 20:56:51 +0000 (21:56 +0100)]
Documentation: pruning recipe for destructive filter-branch

Add a section about how to shrink a repository's size after running
git-filter-branch to remove large blobs from history.

This comes up every week or so on IRC, and the commands required to
handle every case are not very newbie-friendly, so hopefully writing
them down somewhere leads to fewer questions.

It may seem contradictory to document fallbacks for older Gits in
newer docs, but we want to point people at this as a FAQ answer, and
they will frequently not have the newest version installed.

Thanks to Björn Steinbrink and Junio C Hamano for comments and
corrections.

Signed-off-by: Thomas Rast <trast@student.ethz.ch>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agogc: make --prune useful again by accepting an optional parameter
Johannes Schindelin [Sat, 14 Feb 2009 22:10:10 +0000 (23:10 +0100)]
gc: make --prune useful again by accepting an optional parameter

With this patch, "git gc --no-prune" will not prune any loose (and
dangling) object, and "git gc --prune=5.minutes.ago" will prune
all loose objects older than 5 minutes.

This patch benefitted from suggestions by Thomas Rast and Jan Krï¿œger.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoTeach @{-1} to git merge
Junio C Hamano [Sat, 14 Feb 2009 07:26:12 +0000 (23:26 -0800)]
Teach @{-1} to git merge

1.6.2 will have @{-1} syntax advertised as "usable anywhere you can use
a branch name".  However, "git merge @{-1}" did not work.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoTeach the "@{-1} syntax to "git branch"
Junio C Hamano [Sat, 14 Feb 2009 07:08:05 +0000 (23:08 -0800)]
Teach the "@{-1} syntax to "git branch"

This teaches the new "@{-1} syntax to refer to the previous branch to "git
branch".  After looking at somebody's faulty patch series on a topic
branch too long, if you decide it is not worth merging, you can just say:

    $ git checkout master
    $ git branch -D @{-1}

to get rid of it without having to type the name of the topic you now hate
so much for wasting a lot of your time.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agosymbolic-ref: allow refs/<whatever> in HEAD
Jeff King [Fri, 13 Feb 2009 18:26:09 +0000 (13:26 -0500)]
symbolic-ref: allow refs/<whatever> in HEAD

Commit afe5d3d5 introduced a safety valve to symbolic-ref to
disallow installing an invalid HEAD. It was accompanied by
b229d18a, which changed validate_headref to require that
HEAD contain a pointer to refs/heads/ instead of just refs/.
Therefore, the safety valve also checked for refs/heads/.

As it turns out, topgit is using refs/top-bases/ in HEAD,
leading us to re-loosen (at least temporarily) the
validate_headref check made in b229d18a. This patch does the
corresponding loosening for the symbolic-ref safety valve,
so that the two are in agreement once more.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoRemove redundant bit clears from diff_setup()
Keith Cascio [Fri, 13 Feb 2009 17:33:34 +0000 (09:33 -0800)]
Remove redundant bit clears from diff_setup()

All bits already clear after memset(0).

Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agolog: do not print ellipses with --abbrev-commit
Thomas Rast [Fri, 13 Feb 2009 22:10:41 +0000 (23:10 +0100)]
log: do not print ellipses with --abbrev-commit

'git log --abbrev-commit' added an ellipsis to all commit names that
were abbreviated.  This was particularly annoying if you wanted to
cut&paste the sha1 from the terminal, since selecting by word would
pick up '...'  too.

So use find_unique_abbrev() instead of diff_unique_abbrev() in all
log-related commit sha1 printing routines, and also change the
formatting of the 'Merge: parent1 parent2' line output via
pretty_print_commit().

Signed-off-by: Thomas Rast <trast@student.ethz.ch>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agobash-completion: Complete the values of color.interactive, color.ui, color.pager
Matt Kraai [Thu, 12 Feb 2009 15:55:54 +0000 (07:55 -0800)]
bash-completion: Complete the values of color.interactive, color.ui, color.pager

Signed-off-by: Matt Kraai <kraai@ftbfs.org>
Acked-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoInstall the default "master" branch configuration after cloning a void
Junio C Hamano [Thu, 12 Feb 2009 06:42:27 +0000 (22:42 -0800)]
Install the default "master" branch configuration after cloning a void

After "cloning from an empty repository", we have a configuration to
describe the remote's URL and the default ref mappings, but we lack the
branch configuration for the default branch we create on our end,
"master".

It is likely that the empty repository we cloned from will point the
default "master" branch with its HEAD, so prepare the local configuration
to match.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoUpdate documentation to add further information about using Thunderbird with git...
Jeremy White [Thu, 12 Feb 2009 21:17:04 +0000 (15:17 -0600)]
Update documentation to add further information about using Thunderbird with git-imap-send.

Signed-off-by: Jeremy White <jwhite@codeweavers.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agogit-rebase.txt: --interactive does not work with --whitespace
Mark Burton [Thu, 12 Feb 2009 10:21:19 +0000 (10:21 +0000)]
git-rebase.txt: --interactive does not work with --whitespace

Signed-off-by: Mark Burton <markb@ordern.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoAdd 'rm -f' equivalent to 'git rm' example of filter-branch --index-filter
Jacob Helwig [Thu, 12 Feb 2009 18:01:10 +0000 (10:01 -0800)]
Add 'rm -f' equivalent to 'git rm' example of filter-branch --index-filter

Signed-off-by: Jacob Helwig <jacob.helwig@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoRevert "validate_headref: tighten ref-matching to just branches"
Junio C Hamano [Thu, 12 Feb 2009 21:02:09 +0000 (13:02 -0800)]
Revert "validate_headref: tighten ref-matching to just branches"

This reverts commit b229d18a809c169314b7f0d048dc5a7632e8f916, at least
until we figure out how to work better with TopGit that points HEAD to
refs/top-bases/ hierarchy.

15 years agoBugfix: GIT_EXTERNAL_DIFF with more than one changed files
Nazri Ramliy [Thu, 12 Feb 2009 13:36:14 +0000 (21:36 +0800)]
Bugfix: GIT_EXTERNAL_DIFF with more than one changed files

When there is more than one file that are changed, running git diff with
GIT_EXTERNAL_DIFF incorrectly diagnoses an programming error and dies.
The check introduced in 479b0ae (diff: refactor tempfile cleanup handling,
2009-01-22) to detect a temporary file slot that forgot to remove its
temporary file was inconsistent with the way the codepath to remove the
temporary to mark the slot that it is done with it.

This patch fixes this problem and adds a test case for it.

Signed-off-by: Nazri Ramliy <ayiehere@gmail.com>
Acked-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoMerge branch 'maint'
Junio C Hamano [Thu, 12 Feb 2009 02:47:30 +0000 (18:47 -0800)]
Merge branch 'maint'

* maint:
  Prepare for 1.6.1.4.
  Make repack less likely to corrupt repository
  fast-export: ensure we traverse commits in topological order
  Clear the delta base cache if a pack is rebuilt

Conflicts:
RelNotes

15 years agoPrepare for 1.6.1.4.
Junio C Hamano [Thu, 12 Feb 2009 02:44:03 +0000 (18:44 -0800)]
Prepare for 1.6.1.4.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoMerge branch 'maint-1.6.0' into maint
Junio C Hamano [Thu, 12 Feb 2009 02:32:37 +0000 (18:32 -0800)]
Merge branch 'maint-1.6.0' into maint

* maint-1.6.0:
  Make repack less likely to corrupt repository
  fast-export: ensure we traverse commits in topological order
  Clear the delta base cache if a pack is rebuilt

15 years agoMake repack less likely to corrupt repository
Junio C Hamano [Tue, 10 Feb 2009 20:16:31 +0000 (12:16 -0800)]
Make repack less likely to corrupt repository

Some platforms refuse to rename a file that is open.  When repacking an
already packed repository without adding any new object, the resulting
pack will contain the same set of objects as an existing pack, and on such
platforms, a newly created packfile cannot replace the existing one.

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

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

This is based on an initial patch by Robin Rosenberg.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agofast-export: ensure we traverse commits in topological order
Elijah Newren [Wed, 11 Feb 2009 06:03:53 +0000 (23:03 -0700)]
fast-export: ensure we traverse commits in topological order

fast-export will only list as parents those commits which have already
been traversed (making it appear as if merges have been squashed if not
all parents have been traversed).  To avoid this silent squashing of
merge commits, we request commits in topological order.

Signed-off-by: Elijah Newren <newren@gmail.com>
Acked-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>