gitweb.git
git-web--browse: avoid the use of evalChris Packham Sun, 2 Oct 2011 00:44:17 +0000 (13:44 +1300)

git-web--browse: avoid the use of eval

Using eval causes problems when the URL contains an appropriately
escaped ampersand (\&). Dropping eval from the built-in browser
invocation avoids the problem.

Helped-by: Jeff King <peff@peff.net> (test case)
Signed-off-by: Chris Packham <judge.packham@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Git 1.7.7 v1.7.7Junio C Hamano Fri, 30 Sep 2011 21:20:57 +0000 (14:20 -0700)

Git 1.7.7

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

use new Git::config_path() for aliasesfileCord Seele Fri, 30 Sep 2011 10:52:25 +0000 (12:52 +0200)

use new Git::config_path() for aliasesfile

Signed-off-by: Cord Seele <cowose@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Add Git::config_path()Cord Seele Fri, 30 Sep 2011 10:52:24 +0000 (12:52 +0200)

Add Git::config_path()

Use --path option when calling 'git config' thus allow for pathname
expansion, e.g. a tilde.

Signed-off-by: Cord Seele <cowose@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

refs: Use binary search to lookup refs fasterJulian Phillips Thu, 29 Sep 2011 22:11:42 +0000 (23:11 +0100)

refs: Use binary search to lookup refs faster

Currently we linearly search through lists of refs when we need to
find a specific ref. This can be very slow if we need to lookup a
large number of refs. By changing to a binary search we can make this
faster.

In order to be able to use a binary search we need to change from
using linked lists to arrays, which we can manage using ALLOC_GROW.

We can now also use the standard library qsort function to sort the
refs arrays.

Signed-off-by: Julian Phillips <julian@quantumfyre.co.uk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

receive-pack: don't pass non-existent refs to post... Pang Yan Han Wed, 28 Sep 2011 15:39:35 +0000 (23:39 +0800)

receive-pack: don't pass non-existent refs to post-{receive,update} hooks

When a push specifies deletion of non-existent refs, the post post-receive and
post-update hooks receive them as input/arguments.

For instance, for the following push, where refs/heads/nonexistent is a ref
which does not exist on the remote side:

git push origin :refs/heads/nonexistent

the post-receive hook receives from standard input:

<null-sha1> SP <null-sha1> SP refs/heads/nonexistent

and the post-update hook receives as arguments:

refs/heads/nonexistent

which does not make sense since it is a no-op.

Teach receive-pack not to pass non-existent refs to the post-receive and
post-update hooks. If the push only attempts to delete non-existent refs,
these hooks are not even called.

The update and pre-receive hooks are still notified about attempted
deletion of non-existent refs to give them a chance to inspect the
situation and act on it.

[jc: mild fix-ups to avoid introducing an extra list; also added fixes to
some tests]

Signed-off-by: Pang Yan Han <pangyanhan@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

checkout $tree $path: do not clobber local changes... Junio C Hamano Fri, 30 Sep 2011 17:33:15 +0000 (10:33 -0700)

checkout $tree $path: do not clobber local changes in $path not in $tree

Checking paths out of a tree is (currently) defined to do:

- Grab the paths from the named tree that match the given pathspec,
and add them to the index;

- Check out the contents from the index for paths that match the
pathspec to the working tree; and while at it

- If the given pathspec did not match anything, suspect a typo from the
command line and error out without updating the index nor the working
tree.

Suppose that the branch you are working on has dir/myfile, and the "other"
branch has dir/other but not dir/myfile. Further imagine that you have
either modified or removed dir/myfile in your working tree, but you have
not run "git add dir/myfile" or "git rm dir/myfile" to tell Git about your
local change. Running

$ git checkout other dir

would add dir/other to the index with the contents taken out of the
"other" branch, and check out the paths from the index that match the
pathspec "dir", namely, "dir/other" and "dir/myfile", overwriting your
local changes to "dir/myfile", even though "other" branch does not even
know about that file.

Fix it by updating the working tree only with the index entries that
was read from the "other" tree.

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

send-email: auth plain/login fixZbigniew Jędrzejewski-Szmek Thu, 29 Sep 2011 17:02:45 +0000 (19:02 +0200)

send-email: auth plain/login fix

git send-email was not authenticating properly when communicating over
TLS with a server supporting only AUTH PLAIN and AUTH LOGIN. This is
e.g. the standard server setup under debian with exim4 and probably
everywhere where system accounts are used.

The problem (only?) exists when libauthen-sasl-cyrus-perl
(Authen::SASL::Cyrus) is installed. Importing Authen::SASL::Perl
makes Authen::SASL use the perl implementation which works
better.

The solution is based on this forum thread:
http://www.perlmonks.org/?node_id=904354.

This patch is tested by sending it. Without this fix, the interaction with
the server failed like this:

$ git send-email --smtp-encryption=tls --smtp-server=... --smtp-debug=1 change1.patch
...
Net::SMTP::SSL=GLOB(0x238f668)<<< 250-AUTH LOGIN PLAIN
Password:
Net::SMTP::SSL=GLOB(0x238f668)>>> AUTH
Net::SMTP::SSL=GLOB(0x238f668)<<< 501 5.5.2 AUTH mechanism must be specified
5.5.2 AUTH mechanism must be specified

Signed-off-by: Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

tree-walk: micro-optimization in tree_entry_interestingDan McGee Fri, 9 Sep 2011 02:02:46 +0000 (21:02 -0500)

tree-walk: micro-optimization in tree_entry_interesting

In the case of a wide breadth top-level tree (~2400 entries, all trees
in this case), we can see a noticeable cost in the profiler calling
strncmp() here. Most of the time we are at the base level of the
repository, so base is "" and baselen == 0, which means we will always
test true. Break out this one tiny case so we can short circuit the
strncmp() call.

Test cases are as follows. packages.git is the Arch Linux git-svn clone
of the packages repository which has the characteristics above.

Commands:
[1] packages.git, /usr/bin/time git log >/dev/null
[2] packages.git, /usr/bin/time git log -- autogen/trunk pacman/trunk wget/trunk >/dev/null
[3] linux.git, /usr/bin/time git log >/dev/null
[4] linux.git, /usr/bin/time git log -- drivers/ata drivers/uio tools >/dev/null

Results:
before after %faster
[1] 2.56 2.55 0.4%
[2] 51.82 48.66 6.5%
[3] 5.58 5.61 -0.5%
[4] 1.55 1.51 0.2%

The takeaway here is this doesn't matter in many operations, but it does
for a certain style of repository and operation where it nets a 6.5%
measured improvement. The other changes are likely not significant by
reasonable statistics methods.

Note: the measured improvement when originally submitted was ~11% (43 to
38 secs) for operation [2]. At the time, the repository had 117220
commits; it now has 137537 commits.

Signed-off-by: Dan McGee <dpmcgee@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

tree-walk: drop unused parameter from match_dir_prefixDan McGee Fri, 9 Sep 2011 02:02:45 +0000 (21:02 -0500)

tree-walk: drop unused parameter from match_dir_prefix

Signed-off-by: Dan McGee <dpmcgee@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

git-remote-mediawiki: allow a domain to be set for... Matthieu Moy Wed, 28 Sep 2011 13:48:01 +0000 (15:48 +0200)

git-remote-mediawiki: allow a domain to be set for authentication

When the wiki uses e.g. LDAP for authentication, the web interface shows
a popup to allow the user to chose an authentication domain, and we need
to use lgdomain in the API at login time.

Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

apply: use OPT_NOOP_NOARGRené Scharfe Wed, 28 Sep 2011 17:47:54 +0000 (19:47 +0200)

apply: use OPT_NOOP_NOARG

Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

revert: use OPT_NOOP_NOARGRené Scharfe Wed, 28 Sep 2011 17:47:50 +0000 (19:47 +0200)

revert: use OPT_NOOP_NOARG

Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

parseopt: add OPT_NOOP_NOARGRené Scharfe Wed, 28 Sep 2011 17:44:30 +0000 (19:44 +0200)

parseopt: add OPT_NOOP_NOARG

Add OPT_NOOP_NOARG, a helper macro to define deprecated options in a
standard way. The help text is taken from the no-op option -r of
git revert.

The callback could be made to emit a (conditional?) warning later. And
we could also add OPT_NOOP (requiring an argument) etc. as needed.

Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

archive.c: use OPT_BOOL()Junio C Hamano Tue, 27 Sep 2011 23:59:01 +0000 (16:59 -0700)

archive.c: use OPT_BOOL()

The list variable (which is OPT_BOOLEAN) is initialized to 0 and only
checked against 0 in the code, so it is safe to use OPT_BOOL().

The worktree_attributes variable (which is OPT_BOOLEAN) is initialized to
0 and later assigned to a field with the same name in struct archive_args,
which is a bitfield of width 1. It is safe and even more correct to use
OPT_BOOL() here; the new test in 5001 demonstrates why using OPT_COUNTUP
is wrong.

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

parse-options: deprecate OPT_BOOLEANJunio C Hamano Tue, 27 Sep 2011 23:56:49 +0000 (16:56 -0700)

parse-options: deprecate OPT_BOOLEAN

It is natural to expect that an option defined with OPT_BOOLEAN() could be
used in this way:

int option = -1; /* unspecified */

struct option options[] = {
OPT_BOOLEAN(0, "option", &option, "set option"),
OPT_END()
};
parse_options(ac, av, prefix, options, usage, 0);

if (option < 0)
... do the default thing ...
else if (!option)
... --no-option was given ...
else
... --option was given ...

to easily tell three cases apart:

- There is no mention of the `--option` on the command line;
- The variable is positively set with `--option`; or
- The variable is explicitly negated with `--no-option`.

Unfortunately, this is not the case. OPT_BOOLEAN() increments the variable
every time `--option` is given, and resets it to zero when `--no-option`
is given.

As a first step to remedy this, introduce a true boolean OPT_BOOL(), and
rename OPT_BOOLEAN() to OPT_COUNTUP(). To help transitioning, OPT_BOOLEAN
and OPTION_BOOLEAN are defined as deprecated synonyms to OPT_COUNTUP and
OPTION_COUNTUP respectively.

This is what db7244b (parse-options new features., 2007-11-07) from four
years ago started by marking OPTION_BOOLEAN as "INCR would have been a
better name".

Some existing users do depend on the count-up semantics; for example,
users of OPT__VERBOSE() could use it to raise the verbosity level with
repeated use of `-v` on the command line, but they probably should be
rewritten to use OPT__VERBOSITY() instead these days. I suspect that some
users of OPT__FORCE() may also use it to implement different level of
forcibleness but I didn't check.

On top of this patch, here are the remaining clean-up tasks that other
people can help:

- Look at each hit in "git grep -e OPT_BOOLEAN"; trace all uses of the
value that is set to the underlying variable, and if it can proven that
the variable is only used as a boolean, replace it with OPT_BOOL(). If
the caller does depend on the count-up semantics, replace it with
OPT_COUNTUP() instead.

- Same for OPTION_BOOLEAN; replace it with OPTION_SET_INT and arrange to
set 1 to the variable for a true boolean, and otherwise replace it with
OPTION_COUNTUP.

- Look at each hit in "git grep -e OPT__VERBOSE -e OPT__QUIET" and see if
they can be replaced with OPT__VERBOSITY().

I'll follow this message up with a separate patch as an example.

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

git-remote-mediawiki: obey advice.pushNonFastForwardMatthieu Moy Tue, 27 Sep 2011 17:55:00 +0000 (19:55 +0200)

git-remote-mediawiki: obey advice.pushNonFastForward

Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

git-remote-mediawiki: set 'basetimestamp' to let the... Matthieu Moy Tue, 27 Sep 2011 17:54:59 +0000 (19:54 +0200)

git-remote-mediawiki: set 'basetimestamp' to let the wiki handle conflicts

We already have a check that no new revisions are on the wiki at the
beginning of the push, but this didn't handle concurrent accesses to the
wiki.

Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

git-remote-mediawiki: trivial fixesMatthieu Moy Tue, 27 Sep 2011 17:54:58 +0000 (19:54 +0200)

git-remote-mediawiki: trivial fixes

Fix a whitespace issue (no space before :) and remove unused %status in
mw_push.

Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

templates/hooks--*: remove sample hooks without any... Gerrit Pape Tue, 27 Sep 2011 11:56:53 +0000 (11:56 +0000)

templates/hooks--*: remove sample hooks without any functionality

Remove the sample post-commit and post-receive hooks. The sample
post-commit doesn't contain any sample functionality and the comments do
not provide more information than already found in the documentation.
The sample post-receive hooks doesn't provide any sample functionality
either and refers in the comments to a contrib hook that might be
installed in different locations on different systems, which isn't that
helpful.

Signed-off-by: Gerrit Pape <pape@smarden.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

notes_merge_commit(): do not pass temporary buffer... Michael Haggerty Tue, 27 Sep 2011 04:46:53 +0000 (06:46 +0200)

notes_merge_commit(): do not pass temporary buffer to other function

It is unsafe to pass a temporary buffer as an argument to
read_directory().

Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Acked-by: Johan Herland <johan@herland.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

gitweb: Fix links to lines in blobs when javascript... Peter Stuge Tue, 27 Sep 2011 09:51:00 +0000 (11:51 +0200)

gitweb: Fix links to lines in blobs when javascript-actions are enabled

The fixLinks() function adds 'js=1' to each link that does not already
have 'js' query parameter specified. This is used to signal to gitweb
that the browser can actually do javascript when these links are used.

There are two problems with the existing code:

1. URIs with fragment and 'js' query parameter, like e.g.

...foo?js=0#l199

were not recognized as having 'js' query parameter already.

2. The 'js' query parameter, in the form of either '?js=1' or ';js=1'
was appended at the end of URI, even if it included a fragment
(had a hash part). This lead to the incorrect links like this

...foo#l199?js=1

instead of adding query parameter as last part of query, but
before the fragment part, i.e.

...foo?js=1#l199

Signed-off-by: Peter Stuge <peter@stuge.se>
Acked-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Don't sort ref_list too earlyJulian Phillips Tue, 27 Sep 2011 00:00:09 +0000 (01:00 +0100)

Don't sort ref_list too early

get_ref_dir is called recursively for subdirectories, which means that
we were calling sort_ref_list for each directory of refs instead of
once for all the refs. This is a massive wast of processing, so now
just call sort_ref_list on the result of the top-level get_ref_dir, so
that the sort is only done once.

In the common case of only a few different directories of refs the
difference isn't very noticable, but it becomes very noticeable when
you have a large number of direcotries containing refs (e.g. as
created by Gerrit).

Reported by Martin Fick.

Signed-off-by: Julian Phillips <julian@quantumfyre.co.uk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

contrib/hooks: adapt comment about Debian install locat... Gerrit Pape Mon, 26 Sep 2011 12:58:35 +0000 (12:58 +0000)

contrib/hooks: adapt comment about Debian install location for contrib hooks

Placing the contrib hooks into /usr/share/doc/ wasn't a good idea in the
first place. According to the Debian policy they should be located in
/usr/share/git-core/, so let's put them there.

Thanks to Bill Allombert for reporting this through
http://bugs.debian.org/640949

Signed-off-by: Gerrit Pape <pape@smarden.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

apply --whitespace=error: correctly report new blank... Junio C Hamano Mon, 26 Sep 2011 20:30:30 +0000 (13:30 -0700)

apply --whitespace=error: correctly report new blank lines at end

Earlier, 77b15bb (apply --whitespace=warn/error: diagnose blank at EOF,
2009-09-03) cheated by reporting the line number of the hunk that contains
the offending line that adds new blank lines at the end of the file. All
other types of whitespace errors are reported with the line number in the
patch file that has the actual offending text.

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

Revert removal of multi-match discard heuristic in... René Scharfe Sun, 25 Sep 2011 13:39:08 +0000 (21:39 +0800)

Revert removal of multi-match discard heuristic in 27af01

27af01d (xdiff/xprepare: improve O(n*m) performance in
xdl_cleanup_records(), 2011-08-17) was supposed to be a performance
boost only. However, it unexpectedly changed the behaviour of diff.

Revert a part of 27af01d that removes logic that mark lines as
"multi-match" (ie. dis[i] == 2). This was preventing the multi-match
discard heuristic (performed in xdl_cleanup_records() and
xdl_clean_mmatch()) from executing.

Reported-by: Alexander Pepper <pepper@inf.fu-berlin.de>
Signed-off-by: René Scharfe <rene.scharfe@lsrfire.ath.cx>
Signed-off-by: Tay Ray Chuan <rctay89@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Merge branch 'jc/namespace-doc-with-old-asciidoc'Junio C Hamano Mon, 26 Sep 2011 17:50:08 +0000 (10:50 -0700)

Merge branch 'jc/namespace-doc-with-old-asciidoc'

* jc/namespace-doc-with-old-asciidoc:
Documentation/gitnamespaces.txt: cater to older asciidoc

git-read-tree.txt: update sparse checkout examplesNguyễn Thái Ngọc Duy Sun, 25 Sep 2011 23:09:15 +0000 (09:09 +1000)

git-read-tree.txt: update sparse checkout examples

The negation example uses '*' to match everything. This used to work
before 9037026 (unpack-trees: fix sparse checkout's "unable to match
directories") because back then, the list of paths is used to match
sparse patterns, so with the patterns

*
!subdir/

subdir/ always matches any path that start with subdir/ and "*" has no
chance to get tested. The result is subdir is excluded.

After the said commit, a tree structure is dynamically created and
sparse pattern matching now follows closely how read_directory()
applies .gitignore. This solves one problem, but reveals another one.

With this new strategy, "!subdir/" rule will be only tested once when
"subdir" directory is examined. Entries inside subdir, when examined,
will match "*" and are (correctly) re-added again because any rules
without a slash will match at every directory level. In the end, "*"
can revert every negation rules.

In order to correctly exclude subdir, we must use

/*
!subdir

to limit "match all" rule at top level only.

"*" rule has no actual use in sparse checkout and can be confusing to
users. While we can automatically turn "*" to "/*", this violates
.gitignore definition. Instead, discourage "*" in favor of "/*" (in
the second example).

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

mergetool: no longer need to save standard inputJunio C Hamano Fri, 16 Sep 2011 20:19:33 +0000 (13:19 -0700)

mergetool: no longer need to save standard input

Earlier code wanted to run merge_file and prompt_after_failed_merge
both of which wanted to read from the standard input of the entire
script inside a while loop, which read from a pipe, and in order to
do so, it redirected the original standard input to another file
descriptor. We no longer need to do so after the previous change.

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

mergetool: Use args as pathspec to unmerged filesJonathon Mah Fri, 16 Sep 2011 02:12:10 +0000 (19:12 -0700)

mergetool: Use args as pathspec to unmerged files

Mergetool now treats its path arguments as a pathspec (like other git
subcommands), restricting action to the given files and directories.
Files matching the pathspec are filtered so mergetool only acts on
unmerged paths; previously it would assume each path argument was in an
unresolved state, and get confused when it couldn't check out their
other stages.

Running "git mergetool subdir" will prompt to resolve all conflicted
blobs under subdir.

Signed-off-by: Jonathon Mah <me@JonathonMah.com>
Acked-by: David Aguilar <davvid@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Git 1.7.7-rc3 v1.7.7-rc3Junio C Hamano Fri, 23 Sep 2011 22:35:57 +0000 (15:35 -0700)

Git 1.7.7-rc3

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

Merge 1.7.6.4 inJunio C Hamano Fri, 23 Sep 2011 22:31:08 +0000 (15:31 -0700)

Merge 1.7.6.4 in

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

merge-recursive: Do not look at working tree during... Junio C Hamano Fri, 23 Sep 2011 22:21:01 +0000 (15:21 -0700)

merge-recursive: Do not look at working tree during a virtual ancestor merge

Fix another instance of a recursive merge incorrectly paying attention to
the working tree file during a virtual ancestor merge, that resulted in
spurious and useless "addinfo_cache failed" error message.

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

Git 1.7.6.4 v1.7.6.4Junio C Hamano Fri, 23 Sep 2011 21:38:39 +0000 (14:38 -0700)

Git 1.7.6.4

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

Merge branch 'cb/maint-ls-files-error-report' into... Junio C Hamano Fri, 23 Sep 2011 21:30:49 +0000 (14:30 -0700)

Merge branch 'cb/maint-ls-files-error-report' into maint

* cb/maint-ls-files-error-report:
t3005: do not assume a particular order of stdout and stderr of git-ls-files
ls-files: fix pathspec display on error

describe: Refresh the index when run with --dirtyAllan Caffee Mon, 1 Aug 2011 01:52:41 +0000 (21:52 -0400)

describe: Refresh the index when run with --dirty

When running git describe --dirty the index should be refreshed. Previously
the cached index would cause describe to think that the index was dirty when,
in reality, it was just stale.

The issue was exposed by python setuptools which hardlinks files into another
directory when building a distribution.

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

Merge branch 'jc/maint-clone-alternates' into maintJunio C Hamano Fri, 23 Sep 2011 21:27:33 +0000 (14:27 -0700)

Merge branch 'jc/maint-clone-alternates' into maint

* jc/maint-clone-alternates:
clone: clone from a repository with relative alternates
clone: allow more than one --reference

Merge branch 'nd/maint-clone-gitdir' into maintJunio C Hamano Fri, 23 Sep 2011 21:21:39 +0000 (14:21 -0700)

Merge branch 'nd/maint-clone-gitdir' into maint

* nd/maint-clone-gitdir:
clone: allow to clone from .git file
read_gitfile_gently(): rename misnamed function to read_gitfile()

Merge branch 'mh/check-ref-format-print-normalize'... Junio C Hamano Fri, 23 Sep 2011 21:20:51 +0000 (14:20 -0700)

Merge branch 'mh/check-ref-format-print-normalize' into maint

* mh/check-ref-format-print-normalize:
Forbid DEL characters in reference names
check-ref-format --print: Normalize refnames that start with slashes

Merge branch 'mg/branch-set-upstream-previous' into... Junio C Hamano Fri, 23 Sep 2011 21:16:22 +0000 (14:16 -0700)

Merge branch 'mg/branch-set-upstream-previous' into maint

* mg/branch-set-upstream-previous:
branch.c: use the parsed branch name

Merge branch 'gb/maint-am-patch-format-error-message... Junio C Hamano Fri, 23 Sep 2011 21:11:18 +0000 (14:11 -0700)

Merge branch 'gb/maint-am-patch-format-error-message' into maint

* gb/maint-am-patch-format-error-message:
am: format is in $patch_format, not parse_patch

t0003: remove extra whitespacesJunio C Hamano Thu, 22 Sep 2011 23:34:05 +0000 (16:34 -0700)

t0003: remove extra whitespaces

The test had excess whitespaces everywhere that made it harder to
read than necessary. Remove them.

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

Teach '--cached' option to check-attrJay Soffian Thu, 22 Sep 2011 21:44:20 +0000 (17:44 -0400)

Teach '--cached' option to check-attr

This option causes check-attr to consider .gitattributes only from
the index, ignoring .gitattributes from the working tree. This allows
the command to be used in situations where a working tree does not exist.

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

fast-import: don't allow to note on empty branchDmitry Ivankov Thu, 22 Sep 2011 19:47:05 +0000 (01:47 +0600)

fast-import: don't allow to note on empty branch

'reset' command makes fast-import start a branch from scratch. It's name
is kept in lookup table but it's sha1 is null_sha1 (special value).
'notemodify' command can be used to add a note on branch head given it's
name. lookup_branch() is used it that case and it doesn't check for
null_sha1. So fast-import writes a note for null_sha1 object instead of
giving a error.

Add a check to deny adding a note on empty branch and add a corresponding
test.

Signed-off-by: Dmitry Ivankov <divanorama@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

fast-import: don't allow to tag empty branchDmitry Ivankov Thu, 22 Sep 2011 19:47:04 +0000 (01:47 +0600)

fast-import: don't allow to tag empty branch

'reset' command makes fast-import start a branch from scratch. It's name
is kept in lookup table but it's sha1 is null_sha1 (special value).
'tag' command can be used to tag a branch by it's name. lookup_branch()
is used it that case and it doesn't check for null_sha1. So fast-import
writes a tag for null_sha1 object instead of giving a error.

Add a check to deny tagging an empty branch and add a corresponding test.

Signed-off-by: Dmitry Ivankov <divanorama@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Add explanation why we do not allow to sparse checkout... Nguyễn Thái Ngọc Duy Thu, 22 Sep 2011 11:24:23 +0000 (21:24 +1000)

Add explanation why we do not allow to sparse checkout to empty working tree

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

sparse checkout: show error messages when worktree... Nguyễn Thái Ngọc Duy Thu, 22 Sep 2011 11:24:22 +0000 (21:24 +1000)

sparse checkout: show error messages when worktree shaping fails

verify_* functions can queue errors up and to be printed later at
label return_failed. In case of errors, do not go to label "done"
directly because all queued messages would be dropped on the floor.

Found-by: Joshua Jensen <jjensen@workspacewhiz.com>
Tracked-down-by: Michael J Gruber <git@drmicha.warpmail.net>
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

diff: teach --stat/--numstat to honor -U$numJunio C Hamano Thu, 22 Sep 2011 17:54:47 +0000 (10:54 -0700)

diff: teach --stat/--numstat to honor -U$num

"git diff -p" piped to external diffstat and "git diff --stat" may see
different patch text (both are valid and describe the same change
correctly) when counting the number of added and deleted lines, arriving
at different results to confuse the users, as --stat/--numstat codepath
always uses the hardcoded -U0 as the context length.

Make --stat/--numstat codepath to honor the context length the same way
as the textual patch codepath does to avoid this problem.

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

patch-id.c: use strbuf instead of a fixed bufferMichael Schubert Wed, 21 Sep 2011 12:42:22 +0000 (14:42 +0200)

patch-id.c: use strbuf instead of a fixed buffer

get_one_patchid() uses a rather dumb heuristic to determine if the
passed buffer is part of the next commit. Whenever the first 40 bytes
are a valid hexadecimal sha1 representation, get_one_patchid() returns
next_sha1.

Once the current line is longer than the fixed buffer, this will break
(provided the additional bytes make a valid hexadecimal sha1). As a result
patch-id returns incorrect results. Instead, use strbuf and read one line
at a time.

Helped-by: Jeff King <peff@peff.net>
Signed-off-by: Michael Schubert <mschub@elegosoft.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

git-read-tree.txt: correct sparse-checkout and skip... Michael J Gruber Wed, 21 Sep 2011 07:48:38 +0000 (09:48 +0200)

git-read-tree.txt: correct sparse-checkout and skip-worktree description

The description of .git/info/sparse-checkout and
skip-worktree is exactly the opposite of what is true, which is:

If a file matches a pattern in sparse-checkout, then (it is to be
checked out and therefore) skip-worktree is unset for that file;
otherwise, it is set (so that it is not checked out).

Currently, the opposite is documented, and (consistently) read-tree's
behavior with respect to bit flips is descibed incorrectly.

Fix it.

In hindsight, it would have been much better to have a "sparse-ignore"
or "sparse-skip" file so that an empty file would mean a full checkout,
and the file logic would be analogous to that of .gitignore, excludes
and skip-worktree.

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

git-read-tree.txt: language and typography fixesMichael J Gruber Wed, 21 Sep 2011 07:48:37 +0000 (09:48 +0200)

git-read-tree.txt: language and typography fixes

Fix a few missing articles and such, and mark-up 'commands' and `files`
appropriately.

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

unpack-trees: print "Aborting" to stderrMichael J Gruber Wed, 21 Sep 2011 07:48:36 +0000 (09:48 +0200)

unpack-trees: print "Aborting" to stderr

display_error_msgs() prints all the errors to stderr already (if any),
followed by "Aborting" (if any) to stdout. Make the latter go to stderr
instead.

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

Remove 'working copy' from the documentation and C... Carlos Martín Nieto Tue, 20 Sep 2011 20:25:57 +0000 (22:25 +0200)

Remove 'working copy' from the documentation and C code

The git term is 'working tree', so replace the most public references
to 'working copy'.

Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

t9159-*.sh: skip for mergeinfo test for svn <= 1.4Ramsay Jones Sat, 10 Sep 2011 17:40:10 +0000 (18:40 +0100)

t9159-*.sh: skip for mergeinfo test for svn <= 1.4

t9159 relies on the command-line syntax of svn >= 1.5. Given the
declining install base of older svn versions, it is not worth our time to
support older svn syntax.

Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
Acked-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Documentation/git-update-index: refer to 'ls-files'Stefan Naewe Wed, 21 Sep 2011 06:21:50 +0000 (08:21 +0200)

Documentation/git-update-index: refer to 'ls-files'

'ls-files' refers to 'update-index' to show how the 'assume unchanged'
bit can be seen. This makes the connection 'bi-directional'.

Signed-off-by: Stefan Naewe <stefan.naewe@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

bisect: fix exiting when checkout failed in bisect_start()Christian Couder Wed, 21 Sep 2011 05:17:24 +0000 (07:17 +0200)

bisect: fix exiting when checkout failed in bisect_start()

Commit 4796e823 ("bisect: introduce --no-checkout support into porcelain." Aug 4 2011)
made checking out the branch where we started depends on the "checkout" mode. But
unfortunately it lost the "|| exit" part after the checkout command.

As it makes no sense to continue if the checkout failed and as people have already
complained that the error message given when we just exit in this case is not clear, see:

http://thread.gmane.org/gmane.comp.version-control.git/180733/

this patch adds a "|| die <hopefully clear message>" part after the checkout command.

Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
Acked-by: Jon Seymour <jon.seymour@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Merge branch 'maint'Junio C Hamano Tue, 20 Sep 2011 03:46:48 +0000 (20:46 -0700)

Merge branch 'maint'

* maint:
git-mergetool: check return value from read

git-mergetool: check return value from readJay Soffian Mon, 19 Sep 2011 23:40:52 +0000 (19:40 -0400)

git-mergetool: check return value from read

Mostly fixed already by 6b44577 (mergetool: check return value
from read, 2011-07-01). Catch two uses it missed.

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

Merge branch 'ph/format-patch-no-color'Junio C Hamano Mon, 19 Sep 2011 20:15:41 +0000 (13:15 -0700)

Merge branch 'ph/format-patch-no-color'

* ph/format-patch-no-color:
t4014: clean up format.thread config after each test

t4014: clean up format.thread config after each testJeff King Mon, 19 Sep 2011 19:15:45 +0000 (15:15 -0400)

t4014: clean up format.thread config after each test

The threading tests turn on format.thread, but never clean
up after themselves, meaning that later tests will also have
format.thread set.

This is more annoying than most leftover config, too,
because not only does it impact the results of other tests,
but it does so non-deterministically. Threading requires the
generation of message-ids, which incorporate the current
time, meaning a slow-running test script may generate
different results from run to run.

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

Teach progress eye-candy to fetch_refs_from_bundle()Junio C Hamano Sun, 18 Sep 2011 23:52:32 +0000 (16:52 -0700)

Teach progress eye-candy to fetch_refs_from_bundle()

With the usual "git" transport, a large-ish transfer with "git fetch" and
"git pull" give progress eye-candy to avoid boring users. However, not
when they are reading from a bundle. I.e.

$ git pull ../git-bundle.bndl master

This teaches bundle.c:unbundle() to give "-v" option to index-pack and
tell it to give progress bar when transport decides it is necessary.

The operation in the other direction, "git bundle create", could also
learn to honor --quiet but that is a separate issue.

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

Git 1.7.7-rc2 v1.7.7-rc2Junio C Hamano Sun, 18 Sep 2011 22:41:34 +0000 (15:41 -0700)

Git 1.7.7-rc2

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

Accept tags in HEAD or MERGE_HEADNguyễn Thái Ngọc Duy Sat, 17 Sep 2011 11:57:45 +0000 (21:57 +1000)

Accept tags in HEAD or MERGE_HEAD

HEAD and MERGE_HEAD (among other branch tips) should never hold a
tag. That can only be caused by broken tools and is cumbersome to fix
by an end user with:

$ git update-ref HEAD $(git rev-parse HEAD^{commit})

which may look like a magic to a new person.

Be easy, warn users (so broken tools can be fixed if they bother to
report) and move on.

Be robust, if the given SHA-1 cannot be resolved to a commit object,
die (therefore return value is always valid).

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

merge: remove global variable head[]Nguyễn Thái Ngọc Duy Sat, 17 Sep 2011 11:57:44 +0000 (21:57 +1000)

merge: remove global variable head[]

Also kill head_invalid in favor of "head_commit == NULL".

Local variable "head" in cmd_merge() is renamed to "head_sha1" to make
sure I don't miss any access because this variable should not be used
after head_commit is set (use head_commit->object.sha1 instead).

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

merge: use return value of resolve_ref() to determine... Nguyễn Thái Ngọc Duy Sat, 17 Sep 2011 11:57:43 +0000 (21:57 +1000)

merge: use return value of resolve_ref() to determine if HEAD is invalid

resolve_ref() only updates "head" when it returns non NULL value (it
may update "head" even when returning NULL, but not in all cases).

Because "head" is not initialized before the call, is_null_sha1() is
not enough. Check also resolve_ref() return value.

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Merge branch 'ci/forbid-unwanted-current-branch-update'Junio C Hamano Sat, 17 Sep 2011 04:48:10 +0000 (21:48 -0700)

Merge branch 'ci/forbid-unwanted-current-branch-update'

* ci/forbid-unwanted-current-branch-update:
branch --set-upstream: regression fix

branch --set-upstream: regression fixJunio C Hamano Fri, 16 Sep 2011 23:28:38 +0000 (16:28 -0700)

branch --set-upstream: regression fix

The "git branch" command, while not in listing mode, calls create_branch()
even when the target branch already exists, and it does so even when it is
not interested in updating the value of the branch (i.e. the name of the
commit object that sits at the tip of the existing branch). This happens
when the command is run with "--set-upstream" option.

The earlier safety-measure to prevent "git branch -f $branch $commit" from
updating the currently checked out branch did not take it into account,
and we no longer can update the tracking information of the current branch.

Minimally fix this regression by telling the validation code if it is
called to really update the value of a potentially existing branch, or if
the caller merely is interested in updating auxiliary aspects of a branch.

Reported-and-Tested-by: Jay Soffian
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Disambiguate duplicate t9160* testsFrédéric Heitzmann Fri, 16 Sep 2011 19:55:03 +0000 (21:55 +0200)

Disambiguate duplicate t9160* tests

1e5814f created t9160-git-svn-mergeinfo-push.sh on 11/9/7
40a1530 created t9160-git-svn-preserve-empty-dirs.sh on 11/7/20
The former test script is renumbered to t9161.

Signed-off-by: Frédéric Heitzmann <frederic.heitzmann@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

ls-remote: a lone "-h" is asking for helpJunio C Hamano Fri, 16 Sep 2011 18:14:27 +0000 (11:14 -0700)

ls-remote: a lone "-h" is asking for help

What should happen if you run this command?

$ git ls-remote -h

It does not give a short-help for the command. Instead because "-h" is a
synonym for "--heads", it runs "git ls-remote --heads", and because there
is no remote specified on the command line, we run it against the default
"origin" remote, hence end up doing the same as

$ git ls-remote --heads origin

Fix this counter-intuitive behaviour by special casing a lone "-h" that
does not have anything else on the command line and calling usage().

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

gitweb: Strip non-printable characters from syntax... Jakub Narebski Fri, 16 Sep 2011 12:41:57 +0000 (14:41 +0200)

gitweb: Strip non-printable characters from syntax highlighter output

The current code, as is, passes control characters, such as form-feed
(^L) to highlight which then passes it through to the browser. User
agents (web browsers) that support 'application/xhtml+xml' usually
require that web pages declared as XHTML and with this mimetype are
well-formed XML. Unescaped control characters cannot appear within a
contents of a valid XML document.

This will cause the browser to display one of the following warnings:

* Safari v5.1 (6534.50) & Google Chrome v13.0.782.112:

This page contains the following errors:

error on line 657 at column 38: PCDATA invalid Char value 12
Below is a rendering of the page up to the first error.

* Mozilla Firefox 3.6.19 & Mozilla Firefox 5.0:

XML Parsing Error: not well-formed
Location:
http://path/to/git/repo/blah/blah

Both errors were generated by gitweb.perl v1.7.3.4 w/ highlight 2.7
using arch/ia64/kernel/unwind.c from the Linux kernel.

When syntax highlighter is not used, control characters are replaced
by esc_html(), but with syntax highlighter they were passed through to
browser (to_utf8() doesn't remove control characters).

Introduce sanitize() subroutine which strips forbidden characters, but
does not perform HTML escaping, and use it in git_blob() to sanitize
syntax highlighter output for XHTML.

Note that excluding "\t" (U+0009), "\n" (U+000A) and "\r" (U+000D) is
not strictly necessary, atleast for currently the only callsite: "\t"
tabs are replaced by spaces by untabify(), "\n" is stripped from each
line before processing it, and replacing "\r" could be considered
improvement.

Originally-by: Christopher M. Fuhrman <cfuhrman@panix.com>
Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Documentation/gitnamespaces.txt: cater to older asciidocJunio C Hamano Fri, 16 Sep 2011 00:09:41 +0000 (17:09 -0700)

Documentation/gitnamespaces.txt: cater to older asciidoc

Older asciidoc (e.g. 8.2.5 on Centos 5.5) is unhappy if a manpage does not
have a SYNOPSIS section. Show a sample (and a possibly bogus) command line
of running two commands that pay attention to this environment variable
with a customized value.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
Reviewed-by: Jamey Sharp <jamey@minilop.net>

filter-branch: use require_clean_work_treeJeff King Thu, 1 Sep 2011 21:53:07 +0000 (17:53 -0400)

filter-branch: use require_clean_work_tree

Filter-branch already requires that we have a clean work
tree before starting. However, it failed to refresh the
index before checking, which means it could be wrong in the
case of stat-dirtiness.

Instead of simply adding a call to refresh the index, let's
switch to using the require_clean_work_tree function
provided by git-sh-setup. It does exactly what we want, and
with fewer lines of code and more specific output messages.

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

Allow git merge ":/<pattern>"Junio C Hamano Wed, 7 Sep 2011 18:16:03 +0000 (11:16 -0700)

Allow git merge ":/<pattern>"

It probably is not such a good idea to use ":/<pattern>" to specify which
commit to merge, as ":/<pattern>" can often hit unexpected commits, but
somebody tried it and got a nonsense error message:

fatal: ':/Foo bar' does not point to a commit

So here is a for-the-sake-of-consistency update that is fairly useless
that allows users to carefully try not shooting in the foot.

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

grep --no-index: don't use git standard exclusionsBert Wesarg Thu, 15 Sep 2011 18:26:03 +0000 (20:26 +0200)

grep --no-index: don't use git standard exclusions

The --no-index mode is intended to be used outside of a git repository, and
it does not make sense to apply the git standard exclusions outside a git
repositories.

Signed-off-by: Bert Wesarg <bert.wesarg@googlemail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

grep: do not use --index in the short usage outputBert Wesarg Thu, 15 Sep 2011 18:26:02 +0000 (20:26 +0200)

grep: do not use --index in the short usage output

Utilize the PARSE_OPT_NEGHELP option to show --no-index in the usage
generated by parse-options.

Signed-off-by: Bert Wesarg <bert.wesarg@googlemail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

t6019: avoid refname collision on case-insensitive... Thomas Rast Thu, 15 Sep 2011 08:34:31 +0000 (10:34 +0200)

t6019: avoid refname collision on case-insensitive systems

The criss-cross tests kept failing for me because of collisions of 'a'
with 'A' etc. Prefix the lowercase refnames with an extra letter to
disambiguate.

Signed-off-by: Thomas Rast <trast@student.ethz.ch>
Acked-by: Brad King <brad.king@kitware.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Merge branch 'ph/format-patch-no-color'Junio C Hamano Thu, 15 Sep 2011 04:43:57 +0000 (21:43 -0700)

Merge branch 'ph/format-patch-no-color'

* ph/format-patch-no-color:
format-patch: ignore ui.color

run_hook: use argv_array APIJeff King Tue, 13 Sep 2011 21:58:25 +0000 (17:58 -0400)

run_hook: use argv_array API

This was a pretty straightforward use, so it really doesn't
save that many lines. Still, perhaps it's a little bit more
readable.

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

checkout: use argv_array APIJeff King Tue, 13 Sep 2011 21:58:19 +0000 (17:58 -0400)

checkout: use argv_array API

We were using a similar ad-hoc rev_list_args structure, but
this saves some code.

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

bisect: use argv_array APIJeff King Tue, 13 Sep 2011 21:58:14 +0000 (17:58 -0400)

bisect: use argv_array API

Now that the argv_array API exists, we can save some lines
of code.

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

quote: provide sq_dequote_to_argv_arrayJeff King Tue, 13 Sep 2011 21:58:08 +0000 (17:58 -0400)

quote: provide sq_dequote_to_argv_array

This is similar to sq_dequote_to_argv, but more convenient
if you have an argv_array. It's tempting to just feed the
components of the argv_array to sq_dequote_to_argv instead,
but:

1. It wouldn't maintain the NULL-termination invariant
of argv_array.

2. It doesn't match the memory ownership policy of
argv_array (in which each component is free-able, not a
pointer into a separate buffer).

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

refactor argv_array into generic codeJeff King Tue, 13 Sep 2011 21:57:57 +0000 (17:57 -0400)

refactor argv_array into generic code

The submodule code recently grew generic code to build a
dynamic argv array. Many other parts of the code can reuse
this, too, so let's make it generically available.

There are two enhancements not found in the original code:

1. We now handle the NULL-termination invariant properly,
even when no strings have been pushed (before, you
could have an empty, NULL argv). This was not a problem
for the submodule code, which always pushed at least
one argument, but was not sufficiently safe for
generic code.

2. There is a formatted variant of the "push" function.
This is a convenience function which was not needed by
the submodule code, but will make it easier to port
other users to the new code.

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

quote.h: fix bogus commentJeff King Tue, 13 Sep 2011 21:57:47 +0000 (17:57 -0400)

quote.h: fix bogus comment

Commit 758e915 made sq_quote_next static, removing it from
quote.h. However, it forgot to update the related comment,
making it appear as a confusing description of sq_quote_to_argv.

Let's remove the crufty bits, and elaborate more on sq_quote_to_argv.

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

add sha1_array API docsJeff King Tue, 13 Sep 2011 21:57:34 +0000 (17:57 -0400)

add sha1_array API docs

This API was introduced in 902bb36, but never documented.
Let's be nice to future users of the code.

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

t3200: clean up checks for file existenceJeff King Tue, 13 Sep 2011 16:13:58 +0000 (12:13 -0400)

t3200: clean up checks for file existence

This patch uses test_path_is_file and test_path_is_missing
instead of "test -f / ! test -f" checks. The former are more
verbose in case of failure and more precise (e.g., is_missing
will check that the entry is actually missing, not just not
a regular file).

As a bonus, this also fixes a few buggy tests that used
"test foo" instead of "test -f foo", and consequently always
reported success.

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

Documentation: basic configuration of notes.rewriteRefThomas Rast Tue, 13 Sep 2011 07:32:42 +0000 (09:32 +0200)

Documentation: basic configuration of notes.rewriteRef

Users had problems finding a working setting for notes.rewriteRef.
Document how to enable rewriting for notes/commits, which should be a
safe setting.

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

git-svn: teach git-svn to populate svn:mergeinfoBryan Jacobs Wed, 7 Sep 2011 17:36:05 +0000 (13:36 -0400)

git-svn: teach git-svn to populate svn:mergeinfo

Allow git-svn to populate the svn:mergeinfo property automatically in
a narrow range of circumstances. Specifically, when dcommitting a
revision with multiple parents, all but (potentially) the first of
which have been committed to SVN in the same repository as the target
of the dcommit.

In this case, the merge info is the union of that given by each of the
parents, plus all changes introduced to the first parent by the other
parents.

In all other cases where a revision to be committed has multiple
parents, cause "git svn dcommit" to raise an error rather than
completing the commit and potentially losing history information in
the upstream SVN repository.

This behavior is disabled by default, and can be enabled by setting
the svn.pushmergeinfo config option.

[ew: minor style changes and manpage merge fix]

Acked-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Bryan Jacobs <bjacobs@woti.com>

send-email: add option -hClemens Buchacher Sat, 3 Sep 2011 17:06:13 +0000 (19:06 +0200)

send-email: add option -h

Most other git commands print a synopsis when passed -h. Make
send-email do the same.

Signed-off-by: Clemens Buchacher <drizzd@aon.at>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

date.c: Support iso8601 timezone formatsHaitao Li Fri, 9 Sep 2011 10:10:33 +0000 (18:10 +0800)

date.c: Support iso8601 timezone formats

Timezone designators in the following formats are all valid according to
ISO8601:2004, section 4.3.2:

[+-]hh, [+-]hhmm, [+-]hh:mm

but we have ignored the ones with colon so far.

Signed-off-by: Haitao Li <lihaitao@gmail.com>
Helped-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

refactor run_receive_hook()Junio C Hamano Thu, 8 Sep 2011 19:17:09 +0000 (12:17 -0700)

refactor run_receive_hook()

Running a hook has to make complex set-up to establish web of
communication between child process and multiplexer, which is common
regardless of what kind of data is fed to the hook. Refactor the parts
that is specific to the data fed to the particular set of hooks from the
part that runs the hook, so that the code can be reused to drive hooks
that take different kind of data.

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

rename pathspec_prefix() to common_prefix() and move... Clemens Buchacher Sun, 4 Sep 2011 10:42:01 +0000 (12:42 +0200)

rename pathspec_prefix() to common_prefix() and move to dir.[ch]

Also make common_prefix_len() static as this refactoring makes dir.c
itself the only caller of this helper function.

Signed-off-by: Clemens Buchacher <drizzd@aon.at>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

fetch: avoid quadratic loop checking for updated submodulesJeff King Mon, 12 Sep 2011 19:56:52 +0000 (15:56 -0400)

fetch: avoid quadratic loop checking for updated submodules

Recent versions of git can be slow to fetch repositories with a
large number of refs (or when they already have a large
number of refs). For example, GitHub makes pull-requests
available as refs, which can lead to a large number of
available refs. This slowness goes away when submodule
recursion is turned off:

$ git ls-remote git://github.com/rails/rails.git | wc -l
3034

[this takes ~10 seconds of CPU time to complete]
git fetch --recurse-submodules=no \
git://github.com/rails/rails.git "refs/*:refs/*"

[this still isn't done after 10 _minutes_ of pegging the CPU]
git fetch \
git://github.com/rails/rails.git "refs/*:refs/*"

You can produce a quicker and simpler test case like this:

doit() {
head=`git rev-parse HEAD`
for i in `seq 1 $1`; do
echo $head refs/heads/ref$i
done >.git/packed-refs
echo "==> $1"
rm -rf dest
git init -q --bare dest &&
(cd dest && time git.compile fetch -q .. refs/*:refs/*)
}

rm -rf repo
git init -q repo && cd repo &&
>file && git add file && git commit -q -m one

doit 100
doit 200
doit 400
doit 800
doit 1600
doit 3200

Which yields timings like:

# refs seconds of CPU
100 0.06
200 0.24
400 0.95
800 3.39
1600 13.66
3200 54.09

Notice that although the number of refs doubles in each
trial, the CPU time spent quadruples.

The problem is that the submodule recursion code works
something like:

- for each ref we fetch
- for each commit in git rev-list $new_sha1 --not --all
- add modified submodules to list
- fetch any newly referenced submodules

But that means if we fetch N refs, we start N revision
walks. Worse, because we use "--all", the number of refs we
must process that constitute "--all" keeps growing, too. And
you end up doing O(N^2) ref resolutions.

Instead, this patch structures the code like this:

- for each sha1 we already have
- add $old_sha1 to list $old
- for each ref we fetch
- add $new_sha1 to list $new
- for each commit in git rev-list $new --not $old
- add modified submodules to list
- fetch any newly referenced submodules

This yields timings like:

# refs seconds of CPU
100 0.00
200 0.04
400 0.04
800 0.10
1600 0.21
3200 0.39

Note that the amount of effort doubles as the number of refs
doubles. Similarly, the fetch of rails.git takes about as
much time as it does with --recurse-submodules=no.

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

format-patch: ignore ui.colorPang Yan Han Mon, 12 Sep 2011 17:46:41 +0000 (01:46 +0800)

format-patch: ignore ui.color

commit c9bfb953 (want_color: automatically fallback to color.ui,
2011-08-17) introduced a regression where format-patch produces colorized
patches when color.ui is set to "always".

In f3aafa4 (Disable color detection during format-patch, 2006-07-09),
git_format_config was taught to intercept diff.color to avoid passing it
down to git_log_config and later, git_diff_ui_config.

Teach git_format_config to intercept color.ui in the same way.

Helped-by: Jeff King <peff@peff.net>
Signed-off-by: Pang Yan Han <pangyanhan@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Git 1.7.7-rc1 v1.7.7-rc1Junio C Hamano Mon, 12 Sep 2011 17:44:32 +0000 (10:44 -0700)

Git 1.7.7-rc1

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

Sync with 1.7.6.3Junio C Hamano Mon, 12 Sep 2011 17:43:17 +0000 (10:43 -0700)

Sync with 1.7.6.3

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

Merge branch 'jn/remote-helpers-doc'Junio C Hamano Mon, 12 Sep 2011 17:38:11 +0000 (10:38 -0700)

Merge branch 'jn/remote-helpers-doc'

* jn/remote-helpers-doc:
(short) documentation for the testgit remote helper
Documentation/git-remote-helpers: explain how import works with multiple refs
Documentation/remote-helpers: explain capabilities first

Git 1.7.6.3 v1.7.6.3Junio C Hamano Mon, 12 Sep 2011 17:33:03 +0000 (10:33 -0700)

Git 1.7.6.3

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

Merge branch 'jl/maint-fetch-submodule-check-fix' into... Junio C Hamano Mon, 12 Sep 2011 17:19:57 +0000 (10:19 -0700)

Merge branch 'jl/maint-fetch-submodule-check-fix' into maint

* jl/maint-fetch-submodule-check-fix:
fetch: skip on-demand checking when no submodules are configured

Merge branch 'maint'Junio C Hamano Mon, 12 Sep 2011 05:35:11 +0000 (22:35 -0700)

Merge branch 'maint'

* maint:
Prepare for 1.7.6.3 maintenance release
SubmittingPathces: remove Cogito reference

Conflicts:
RelNotes

Prepare for 1.7.6.3 maintenance releaseJunio C Hamano Mon, 12 Sep 2011 05:08:56 +0000 (22:08 -0700)

Prepare for 1.7.6.3 maintenance release

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