gitweb.git
remote: let guess_remote_head() optionally return all... 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>

remote: make copy_ref() perform a deep copyJay 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>

bisect: fix another instance of eval'ed stringChristian Couder Fri, 27 Feb 2009 06:31:22 +0000 (07:31 +0100)

bisect: fix another instance of eval'ed string

When there is nothing to be skipped, the output from
rev-list --bisect-vars was eval'ed without first being
strung together with &&; this is probably not a problem
as it is much less likely to be a bad input than the list
handcrafted by the filter_skip function, but it still is
a good discipline.

Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

bash completion: add --format= and --oneline options... Teemu Likonen Tue, 24 Feb 2009 13:33:29 +0000 (15:33 +0200)

bash completion: add --format= and --oneline options for "git log"

We also add --format= completion for "git show".

Signed-off-by: Teemu Likonen <tlikonen@iki.fi>
Acked-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Merge branch 'cc/maint-1.6.0-bisect-fix'Junio C Hamano Fri, 27 Feb 2009 09:03:21 +0000 (01:03 -0800)

Merge branch 'cc/maint-1.6.0-bisect-fix'

* cc/maint-1.6.0-bisect-fix:
bisect: fix quoting TRIED revs when "bad" commit is also "skip"ped

Conflicts:
git-bisect.sh

bisect: fix quoting TRIED revs when "bad" commit is... Christian Couder Fri, 27 Feb 2009 06:31:22 +0000 (07:31 +0100)

bisect: fix quoting TRIED revs when "bad" commit is also "skip"ped

When the "bad" commit was also "skip"ped and when more than one
commit was skipped, the "filter_skipped" function would have
printed something like:

bisect_rev=<hash1>|<hash2>

(where <hash1> and <hash2> are hexadecimal sha1 hashes)

and this would have been evaled later as piping "bisect_rev=<hash1>"
into "<hash2>", which would have failed.

So this patch makes the "filter_skipped" function properly quote
what it outputs, so that it will print something like:

bisect_rev='<hash1>|<hash2>'

which will be properly evaled later. The caller was not stopping
properly because the scriptlet this function returned to be evaled
was not strung together with && and because of this, an error in
an earlier part of the output was simply ignored.

A test case is added to the test suite.

And while at it, we also initialize the VARS, FOUND and TRIED
variables, so that we protect ourselves from environment variables
the user may have with these names.

Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

git-am: make --abort less dangerousJunio C Hamano Thu, 26 Feb 2009 19:24:29 +0000 (11:24 -0800)

git-am: make --abort less dangerous

When you are in the middle of "git rebase", "git am --abort" by mistake
would have referred to nonexistent ORIG_HEAD and barfed, or worse yet, used
a stale ORIG_HEAD and taken you to an unexpected commit.

Also the option parsing did not reject "git am --abort --skip".

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

git-am: Keep index in case of abort with dirty indexMichael J Gruber Thu, 26 Feb 2009 09:52:53 +0000 (10:52 +0100)

git-am: Keep index in case of abort with dirty index

git am --abort resets the index unconditionally. But in case a previous
git am exited due to a dirty index it is preferable to keep that index.
Make it so.

Signed-off-by: Michael J Gruber <git@drmicha.warpmail.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

t5540-http-push.sh: avoid non-portable grep -PJay Soffian Thu, 26 Feb 2009 23:44:40 +0000 (18:44 -0500)

t5540-http-push.sh: avoid non-portable grep -P

OS X's GNU grep does not support -P/--perl-regexp.

We use a basic RE instead, and simplify the pattern slightly by
replacing '+' with '*' so it can be more easily expressed using a basic
RE. The important part of pattern, checking for a SHA-1 has suffix in
the successful PUT/MOVE operations, remains the same. Also, a-z instead
of a-f was an obvious mistake in the original RE. Here are samples of
what we want to match:

127.0.0.1 - - [26/Feb/2009:22:38:13 +0000] "PUT /test_repo.git/objects/3e/a4fbb9e18a401a6463c595d08118fcb9fb7426_fab55116904c665a95438bcc78521444a7db6096 HTTP/1.1" 201 277
127.0.0.1 - - [26/Feb/2009:22:38:13 +0000] "MOVE /test_repo.git/objects/3e/a4fbb9e18a401a6463c595d08118fcb9fb7426_fab55116904c665a95438bcc78521444a7db6096 HTTP/1.1" 201 277

Signed-off-by: Jay Soffian <jaysoffian@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Fix odb_mkstemp() on AIXMike Ralphson Thu, 26 Feb 2009 15:31:52 +0000 (16:31 +0100)

Fix odb_mkstemp() on AIX

The AIX mkstemp() modifies its template parameter to an empty string if
the call fails. The existing code had already recomputed the template,
but too late to be good.

See also 6ff6af62, which fixed this problem in a different spot.

Signed-off-by: Mike Ralphson <mike@abacus.co.uk>
Signed-off-by: Johannes Sixt <j6t@kdbg.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

remote: 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>

move locate_head() to remote.cJay 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>

move duplicated ref_newer() to remote.cJay 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>

move duplicated get_local_heads() to remote.cJay 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>

refactor find_ref_by_name() to accept const listJeff 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>

add basic http clone/fetch testsJeff 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>

test scripts: refactor start_httpd helperJeff 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>

GIT 1.6.2-rc2 v1.6.2-rc2Junio 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>

Merge 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

Make sure objects/pack exists before creating a new... 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>

Allow HTTP tests to run on DarwinJay 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>

Fix typo in contrib/examples/git-svnimport.txtMichael 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>

gitattributes.txt: Path matching rules are explained... 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>

sha1_file.c: fix typoFelipe 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>

git add: trivial codestyle cleanupFelipe 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>

README: fix path to "gitcvs-migration.txt" and be more... 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>

trace: 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>

Docs: Expand explanation of the use of + in git push... 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>

git-quiltimport: preserve standard input to be able... 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>

never fallback relative times to absoluteJeff King Tue, 24 Feb 2009 05:42:16 +0000 (00:42 -0500)

never fallback relative times to absolute

Previously, for dates older than 12 months we fell back to just giving the
absolute time. This can be a bit jarring when reading a list of times.

Instead, let's switch to "Y years, M months" for five years, and then just
"Y years" after that.

No particular reason on the 5 year cutoff except that it seemed reasonable
to me.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Add tests for git log --pretty, --format and --oneline.Felipe Contreras Tue, 24 Feb 2009 21:06:37 +0000 (23:06 +0200)

Add tests for git log --pretty, --format and --oneline.

More specifically; --pretty=format, tformat and new %foo shortcut.

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Add --oneline that is a synonym to "--pretty=oneline... Nanako Shiraishi Tue, 24 Feb 2009 09:59:16 +0000 (18:59 +0900)

Add --oneline that is a synonym to "--pretty=oneline --abbrev-commit"

These two are often used together but are too long to type.

Signed-off-by: Nanako Shiraishi <nanako3@lavabit.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Give short-hands to --pretty=tformat:%formatstringNanako Shiraishi Tue, 24 Feb 2009 09:59:15 +0000 (18:59 +0900)

Give short-hands to --pretty=tformat:%formatstring

Allow --pretty="%h %s" (and --format="%h %s") as shorthand for an often
used option --pretty=tformat:"%h %s".

Signed-off-by: Nanako Shiraishi <nanako3@lavabit.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Add --format that is a synonym to --prettyNanako Shiraishi Tue, 24 Feb 2009 09:59:14 +0000 (18:59 +0900)

Add --format that is a synonym to --pretty

Some people prefer to call the pretty-print styles "format", and get
annoyed to see "git log --format=short" fail. Introduce it as a synonym
to --pretty so that both can be used.

Signed-off-by: Nanako Shiraishi <nanako3@lavabit.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Install builtins with the user and group of the install... 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>

Fixup: Add bare repository indicator for __git_ps1Marius Storm-Olsen Sat, 21 Feb 2009 14:48:43 +0000 (15:48 +0100)

Fixup: Add bare repository indicator for __git_ps1

Signed-off-by: Marius Storm-Olsen <git@storm-olsen.com>
Acked-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Merge git://git.bogomips.org/git-svnJunio 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

Convert git-* invocations to "git *" in the svnimport... 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>

git-svn fix to avoid using strftime %zBen 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>

send-email: don't create temporary compose file until... Jay Soffian Mon, 23 Feb 2009 18:51:37 +0000 (13:51 -0500)

send-email: don't create temporary compose file until it is needed

Commit eed6ca7 caused a minor regression when it switched to using
tempfile() to generate the temporary compose file. Since tempfile()
creates the file at the time it generates the filename, zero-length
temporary files are being left behind unless --compose is used (in which
case the file is cleaned up).

This patch fixes the regression by not calling tempfile() to generate
the compose filename unless --compose is in use.

Signed-off-by: Jay Soffian <jaysoffian@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Merge git://git.bogomips.org/git-svnJunio 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

write_index(): update index_state->timestamp after... Kjetil Barvik Mon, 23 Feb 2009 18:02:57 +0000 (19:02 +0100)

write_index(): update index_state->timestamp after flushing to disk

Since this timestamp is used to check for racy-clean files, it is
important to keep it uptodate.

For the 'git checkout' command without the '-q' option, this make a
huge difference. Before, each and every file which was updated, was
racy-clean after the call to unpack_trees() and write_index() but
before the GIT process ended.

And because of the call to show_local_changes() in builtin-checkout.c,
we ended up reading those files back into memory, doing a SHA1 to
check if the files was really different from the index. And, of
course, no file was different.

With this fix, 'git checkout' without the '-q' option should now be
almost as fast as with the '-q' option, but not quite, as we still do
some few lstat(2) calls more without the '-q' option.

Below is some average numbers for 10 checkout's to v2.6.27 and 10 to
v2.6.25 of the Linux kernel, to show the difference:

before (git version 1.6.2.rc1.256.g58a87):
7.860 user 2.427 sys 19.465 real 52.8% CPU faults: 0 major 95331 minor
after:
6.184 user 2.160 sys 17.619 real 47.4% CPU faults: 0 major 38994 minor

Signed-off-by: Kjetil Barvik <barvik@broadpark.no>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

git-p4: avoid syncing duplicate changesPete 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>

Add bare repository indicator for __git_ps1Marius Storm-Olsen Sat, 21 Feb 2009 14:48:43 +0000 (15:48 +0100)

Add bare repository indicator for __git_ps1

Prefixes the branch name with "BARE:" if you're in a
bare repository.

Signed-off-by: Marius Storm-Olsen <git@storm-olsen.com>
Acked-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

git-svn: read the dcommit url from the config file... 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>

git-svn: fix delete+add branch tracking with empty... 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>

git-svn: Create leading directories in create-ignoreBrian 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>

git config: trivial cleanup for editor actionJohannes Schindelin Sat, 21 Feb 2009 00:48:54 +0000 (02:48 +0200)

git config: trivial cleanup for editor action

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

git config: codestyle cleanupsFelipe Contreras Sat, 21 Feb 2009 00:48:53 +0000 (02:48 +0200)

git config: codestyle cleanups

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

format-patch: support deep threadingThomas Rast Thu, 19 Feb 2009 21:26:33 +0000 (22:26 +0100)

format-patch: support deep threading

For deep threading mode, i.e., the mode that gives a thread structured
like

+ [PATCH 0/n] Cover letter
`-+ [PATCH 1/n] First patch
`-+ [PATCH 2/n] Second patch
`-+ ...

we currently have to use 'git send-email --thread' (the default). On
the other hand, format-patch also has a --thread option which gives
shallow mode, i.e.,

+ [PATCH 0/n] Cover letter
|-+ [PATCH 1/n] First patch
|-+ [PATCH 2/n] Second patch
...

To reduce the confusion resulting from having two indentically named
features in different tools giving different results, let format-patch
take an optional argument '--thread=deep' that gives the same output
as 'send-mail --thread'. With no argument, or 'shallow', behave as
before. Also add a configuration variable format.thread with the same
semantics.

Signed-off-by: Thomas Rast <trast@student.ethz.ch>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

format-patch: thread as reply to cover letter even... Thomas Rast Thu, 19 Feb 2009 21:26:32 +0000 (22:26 +0100)

format-patch: thread as reply to cover letter even with in-reply-to

Currently, format-patch --thread --cover-letter --in-reply-to $parent
makes all mails, including the cover letter, a reply to $parent.
However, we would want the reader to consider the cover letter above
all the patches.

This changes the semantics so that only the cover letter is a reply to
$parent, while all the patches are formatted as replies to the cover
letter.

Signed-off-by: Thomas Rast <trast@student.ethz.ch>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

format-patch: track several referencesThomas Rast Thu, 19 Feb 2009 21:26:31 +0000 (22:26 +0100)

format-patch: track several references

Currently, format-patch can only track a single reference (the
In-Reply-To:) for each mail. To ensure proper threading, we should
list all known references for every mail.

Change the rev_info.ref_message_id field to a string_list, so that we
can append references at will, and change the output formatting
routines to print all of them in the References: header. The last
entry in the list is implicitly assumed to be the In-Reply-To:, which
gives output consistent with RFC 2822:

The "References:" field will contain the contents of the parent's
"References:" field (if any) followed by the contents of the
parent's "Message-ID:" field (if any).

Note that this is just preparatory work; nothing uses it yet, so all
"References:" fields in the output are still only one deep.

Signed-off-by: Thomas Rast <trast@student.ethz.ch>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Merge branch 'for-junio' of git://source.winehq.org... 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.

Add 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>

git.el: Improve the confirmation message on remove... 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>

git.el: Make sure that file lists are sorted as they... 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>

Support 'raw' date formatLinus 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>

Test git-patch-idThomas Rast Thu, 19 Feb 2009 11:13:42 +0000 (12:13 +0100)

Test git-patch-id

So far, git-patch-id was untested. Add some simple checks for output
format and patch (in)equality.

Signed-off-by: Thomas Rast <trast@student.ethz.ch>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Test rev-list --parents/--childrenThomas Rast Thu, 19 Feb 2009 11:13:41 +0000 (12:13 +0100)

Test rev-list --parents/--children

Signed-off-by: Thomas Rast <trast@student.ethz.ch>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Test log --decorateThomas Rast Thu, 19 Feb 2009 11:13:40 +0000 (12:13 +0100)

Test log --decorate

Signed-off-by: Thomas Rast <trast@student.ethz.ch>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Test fsck a bit harderThomas Rast Thu, 19 Feb 2009 11:13:39 +0000 (12:13 +0100)

Test fsck a bit harder

git-fsck, of all tools, has very few tests. This adds some more:
* a corrupted object;
* a branch pointing to a non-commit;
* a tag pointing to a nonexistent object;
* and a tag pointing to an object of a type other than what the tag
itself claims.

Only the first two are caught. At least the third probably should,
too, but currently slips through.

Signed-off-by: Thomas Rast <trast@student.ethz.ch>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Test log --graphThomas Rast Thu, 19 Feb 2009 11:13:38 +0000 (12:13 +0100)

Test log --graph

So far there were no tests checking that log --graph actually works.

Note that the tests strip trailing whitespace, as the current --graph
emits trailing whitespace on lines that do not contain anything but
graph lines.

Signed-off-by: Thomas Rast <trast@student.ethz.ch>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Test diff --dirstat functionalityThomas Rast Thu, 19 Feb 2009 11:13:37 +0000 (12:13 +0100)

Test diff --dirstat functionality

This is only a very rudimentary test, but it was untested before.

Signed-off-by: Thomas Rast <trast@student.ethz.ch>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Test that diff can read from stdinThomas Rast Thu, 19 Feb 2009 11:13:36 +0000 (12:13 +0100)

Test that diff can read from stdin

Signed-off-by: Thomas Rast <trast@student.ethz.ch>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Support coverage testing with GCC/gcovThomas Rast Thu, 19 Feb 2009 11:13:35 +0000 (12:13 +0100)

Support coverage testing with GCC/gcov

With gcc's --coverage option, we can perform automatic coverage data
collection for the test suite.

Add a new Makefile target 'coverage' that scraps all previous coverage
results, recompiles git with the required compiler/linker flags (in
addition to any flags you specify manually), then runs the test suite
and compiles a report.

The compilation must be done with all optimizations disabled, since
inlined functions (and for line-by-line coverage, also optimized
branches/loops) break coverage tracking.

The tests are run serially (with -j1). The coverage code should
theoretically allow concurrent access to its data files, but the
author saw random test failures. Obviously this could be improved.

The report currently consists of a list of functions that were never
executed during the tests, which is written to
'coverage-untested-functions'. Once this list becomes reasonably
short, we would also want to look at branches that were never taken.

Currently only toplevel *.c files are considered. It would be nice to
at least include xdiff, but --coverage did not save data to
subdirectories on the system used to write this (gcc 4.3.2).

Signed-off-by: Thomas Rast <trast@student.ethz.ch>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Merge 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

More 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>

Document 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>

gitweb: Hyperlink multiple git hashes on the same commi... 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>

system_path(): simplify using strip_path_suffix(),... 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>

Introduce 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>

format-patch: threading test reactivationThomas Rast Thu, 19 Feb 2009 21:26:30 +0000 (22:26 +0100)

format-patch: threading test reactivation

t4014 tests format-patch --thread since 7d812145, but the tests were
ineffective right from the start at least for bash and dash. The
loops of the form

for ...; do something || break; done

introduced by 7d812145 and 5d02294 always exit with status 0, even if
'something' failed, because 'break' returns 0 unless there was no loop
to break.

We take a rather different approach that uses an admittedly heinous
inline Perl script to mangle all interesting information into a format
that is invariant between runs. We can then test the full patch
sequence in one go (with --stdout), doing away with the loop problem.

Signed-off-by: Thomas Rast <trast@student.ethz.ch>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

verify_uptodate(): add ce_uptodate(ce) testKjetil Barvik Thu, 19 Feb 2009 20:08:30 +0000 (21:08 +0100)

verify_uptodate(): add ce_uptodate(ce) test

If we inside verify_uptodate() can already tell from the ce entry that
it is already uptodate by testing it with ce_uptodate(ce), there is no
need to call lstat(2) and ie_match_stat() afterwards.

And, reading from the commit log message from:

commit eadb5831342bb2e756fa05c03642c4aa1929d4f5
Author: Junio C Hamano <gitster@pobox.com>
Date: Fri Jan 18 23:45:24 2008 -0800

Avoid running lstat(2) on the same cache entry.

this also seems to be correct usage of the ce_uptodate() macro
introduced by that patch.

This will avoid lots of lstat(2) calls in some cases, for example
by running the 'git checkout' command.

Signed-off-by: Kjetil Barvik <barvik@broadpark.no>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

make USE_NSEC work as expectedKjetil Barvik Thu, 19 Feb 2009 20:08:29 +0000 (21:08 +0100)

make USE_NSEC work as expected

Since the filesystem ext4 is now defined as stable in Linux v2.6.28,
and ext4 supports nanonsecond resolution timestamps natively, it is
time to make USE_NSEC work as expected.

This will make racy git situations less likely to happen. For 'git
checkout' this means it will be less likely that we have to open, read
the contents of the file into RAM, and check if file is really
modified or not. The result sould be a litle less used CPU time, less
pagefaults and a litle faster program, at least for 'git checkout'.

Since the number of possible racy git situations would increase when
disks gets faster, this patch would be more and more helpfull as times
go by. For a fast Solid State Disk, this patch should be helpfull.

Note that, when file operations starts to take less than 1 nanosecond,
one would again start to get more racy git situations.

For more info on racy git, see Documentation/technical/racy-git.txt
For more info on ext4, see http://kernelnewbies.org/Ext4

Signed-off-by: Kjetil Barvik <barvik@broadpark.no>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

fix compile error when USE_NSEC is definedKjetil Barvik Thu, 19 Feb 2009 20:08:28 +0000 (21:08 +0100)

fix compile error when USE_NSEC is defined

'struct cache' does not have a 'usec' member, but a 'unsigned int
nsec' member. Simmilar 'struct stat' does not have a 'st_mtim.usec'
member, and we should instead use 'st_mtim.tv_nsec'.

Signed-off-by: Kjetil Barvik <barvik@broadpark.no>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Documentation: Note file formats send-email acceptsTodd 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>

add basic branch display testsJeff King Thu, 19 Feb 2009 03:34:44 +0000 (22:34 -0500)

add basic branch display tests

We were not testing the output of "git branch" anywhere.
Not only does this not protect us against regressions in the
output, but we are not exercising code paths which may have
bugs (such as the one fixed by 45e2b61).

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

branch: clean up repeated strlenJeff King Thu, 19 Feb 2009 03:35:45 +0000 (22:35 -0500)

branch: clean up repeated strlen

Commit 45e2b61 fixed the initialization of a "len" struct
parameter via strlen. We can use that to clean up what is
now 3 strlens in a 6-line sequence.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

check_updates(): effective removal of cache entries... Kjetil Barvik Wed, 18 Feb 2009 22:18:03 +0000 (23:18 +0100)

check_updates(): effective removal of cache entries marked CE_REMOVE

Below is oprofile output from GIT command 'git chekcout -q my-v2.6.25'
(move from tag v2.6.27 to tag v2.6.25 of the Linux kernel):

CPU: Core 2, speed 1999.95 MHz (estimated)
Counted CPU_CLK_UNHALTED events (Clock cycles when not halted) with a unit
mask of 0x00 (Unhalted core cycles) count 20000
Counted INST_RETIRED_ANY_P events (number of instructions retired) with a
unit mask of 0x00 (No unit mask) count 20000
CPU_CLK_UNHALT...|INST_RETIRED:2...|
samples| %| samples| %|
------------------------------------
409247 100.000 342878 100.000 git
CPU_CLK_UNHALT...|INST_RETIRED:2...|
samples| %| samples| %|
------------------------------------
260476 63.6476 257843 75.1996 libz.so.1.2.3
100876 24.6492 64378 18.7758 kernel-2.6.28.4_2.vmlinux
30850 7.5382 7874 2.2964 libc-2.9.so
14775 3.6103 8390 2.4469 git
2020 0.4936 4325 1.2614 libcrypto.so.0.9.8
191 0.0467 32 0.0093 libpthread-2.9.so
58 0.0142 36 0.0105 ld-2.9.so
1 2.4e-04 0 0 libldap-2.3.so.0.2.31

Detail list of the top 20 function entries (libz counted in one blob):

CPU_CLK_UNHALTED INST_RETIRED_ANY_P
samples % samples % image name symbol name
260476 63.6862 257843 75.2725 libz.so.1.2.3 /lib/libz.so.1.2.3
16587 4.0555 3636 1.0615 libc-2.9.so memcpy
7710 1.8851 277 0.0809 libc-2.9.so memmove
3679 0.8995 1108 0.3235 kernel-2.6.28.4_2.vmlinux d_validate
3546 0.8670 2607 0.7611 kernel-2.6.28.4_2.vmlinux __getblk
3174 0.7760 1813 0.5293 libc-2.9.so _int_malloc
2396 0.5858 3681 1.0746 kernel-2.6.28.4_2.vmlinux copy_to_user
2270 0.5550 2528 0.7380 kernel-2.6.28.4_2.vmlinux __link_path_walk
2205 0.5391 1797 0.5246 kernel-2.6.28.4_2.vmlinux ext4_mark_iloc_dirty
2103 0.5142 1203 0.3512 kernel-2.6.28.4_2.vmlinux find_first_zero_bit
2077 0.5078 997 0.2911 kernel-2.6.28.4_2.vmlinux do_get_write_access
2070 0.5061 514 0.1501 git cache_name_compare
2043 0.4995 1501 0.4382 kernel-2.6.28.4_2.vmlinux rcu_irq_exit
2022 0.4944 1732 0.5056 kernel-2.6.28.4_2.vmlinux __ext4_get_inode_loc
2020 0.4939 4325 1.2626 libcrypto.so.0.9.8 /usr/lib/libcrypto.so.0.9.8
1965 0.4804 1384 0.4040 git patch_delta
1708 0.4176 984 0.2873 kernel-2.6.28.4_2.vmlinux rcu_sched_grace_period
1682 0.4112 727 0.2122 kernel-2.6.28.4_2.vmlinux sysfs_slab_alias
1659 0.4056 290 0.0847 git find_pack_entry_one
1480 0.3619 1307 0.3816 kernel-2.6.28.4_2.vmlinux ext4_writepage_trans_blocks

Notice the memmove line, where the CPU did 7710 / 277 = 27.8 cycles
per instruction, and compared to the total cycles spent inside the
source code of GIT for this command, all the memmove() calls
translates to (7710 * 100) / 14775 = 52.2% of this.

Retesting with a GIT program compiled for gcov usage, I found out that
the memmove() calls came from remove_index_entry_at() in read-cache.c,
where we have:

memmove(istate->cache + pos,
istate->cache + pos + 1,
(istate->cache_nr - pos) * sizeof(struct cache_entry *));

remove_index_entry_at() is called 4902 times from check_updates() in
unpack-trees.c, and each time called we move each cache_entry pointers
(from the removed one) one step to the left.

Since we have 28828 entries in the cache this time, and if we on
average move half of them each time, we in total move approximately
4902 * 0.5 * 28828 * 4 = 282 629 712 bytes, or twice this amount if
each pointer is 8 bytes (64 bit).

OK, is seems that the function check_updates() is called 28 times, so
the estimated guess above had been more correct if check_updates() had
been called only once, but the point is: we get lots of bytes moved.

To fix this, and use an O(N) algorithm instead, where N is the number
of cache_entries, we delete/remove all entries in one loop through all
entries.

From a retest, the new remove_marked_cache_entries() from the patch
below, ended up with the following output line from oprofile:

46 0.0105 15 0.0041 git remove_marked_cache_entries

If we can trust the numbers from oprofile in this case, we saved
approximately ((7710 - 46) * 20000) / (2 * 1000 * 1000 * 1000) = 0.077
seconds CPU time with this fix for this particular test. And notice
that now the CPU did only 46 / 15 = 3.1 cycles/instruction.

Signed-off-by: Kjetil Barvik <barvik@broadpark.no>
Acked-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Merge 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

tests: 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>

filter-branch -d: Export GIT_DIR earlierLars 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>

disallow providing multiple upstream branches to 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>

Skip timestamp differences for diff --no-indexMichael 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>

git-add -i/-p: learn to unwrap C-quoted pathsJunio C Hamano Tue, 17 Feb 2009 06:43:43 +0000 (22:43 -0800)

git-add -i/-p: learn to unwrap C-quoted paths

The underlying plumbing commands are not run with -z option, so the paths
returned from them need to be unquoted as needed.

Remove the now stale BUGS section from git-add documentaiton as suggested
by Teemu Likonen.

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

git-svn: fix parsing of timestamp obtained from svnJunio 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>

gitweb: Fix warnings with override permitted but no... 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>

Documentation/git-push: --all, --mirror, --tags can... 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>

bash completion: only show 'log --merge' if mergingThomas 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>

bash completion: refactor common log, shortlog and... 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>

Avoid segfault with 'git branch' when the HEAD is detachedJohannes Schindelin Wed, 18 Feb 2009 18:14:59 +0000 (19:14 +0100)

Avoid segfault with 'git branch' when the HEAD is detached

A recent addition to the ref_item struct was not taken care of, leading
to a segmentation fault when accessing the (uninitialized) "dest" member.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

gitweb: fix wrong base URL when non-root DirectoryIndexGiuseppe 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>

bash: update 'git svn' optionsSZEDER 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>

bash: add missing 'git merge' optionsSZEDER 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>

git-svn: Fix for rewriteRoot URL containing username. v1.6.2-rc1Dé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>

builtin-receive-pack.c: fix compiler warnings about... 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>

RelNotes UpdateJunio C Hamano Sun, 15 Feb 2009 08:15:52 +0000 (00:15 -0800)

RelNotes Update

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

Merge 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

Merge 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

Merge 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