gitweb.git
Merge branch 'jc/no-gitweb-test-without-cgi-etc' into... Junio C Hamano Tue, 23 Aug 2011 22:17:14 +0000 (15:17 -0700)

Merge branch 'jc/no-gitweb-test-without-cgi-etc' into maint

* jc/no-gitweb-test-without-cgi-etc:
t/gitweb-lib.sh: skip gitweb tests when perl dependencies are not met

fast-import: allow to tag newly created objectsDmitry Ivankov Mon, 22 Aug 2011 12:10:19 +0000 (18:10 +0600)

fast-import: allow to tag newly created objects

fast-import allows to tag objects by sha1 and to query sha1 of objects
being imported. So it should allow to tag these objects, make it do so.

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

fast-import: add tests for tagging blobsDmitry Ivankov Mon, 22 Aug 2011 12:10:18 +0000 (18:10 +0600)

fast-import: add tests for tagging blobs

fast-import allows to create an annotated tag that annotates a blob,
via mark or direct sha1 specification.

For mark it works, for sha1 it tries to read the object. It tries to
do so via read_sha1_file, and then checks the size to be at least 46.

That's weird, let's just allow to (annotated) tag any object referenced
by sha1. If the object originates from our packfile, we still fail though.

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

clone: clone from a repository with relative alternatesJunio C Hamano Tue, 23 Aug 2011 01:05:16 +0000 (18:05 -0700)

clone: clone from a repository with relative alternates

Cloning from a local repository blindly copies or hardlinks all the files
under objects/ hierarchy. This results in two issues:

- If the repository cloned has an "objects/info/alternates" file, and the
command line of clone specifies --reference, the ones specified on the
command line get overwritten by the copy from the original repository.

- An entry in a "objects/info/alternates" file can specify the object
stores it borrows objects from as a path relative to the "objects/"
directory. When cloning a repository with such an alternates file, if
the new repository is not sitting next to the original repository, such
relative paths needs to be adjusted so that they can be used in the new
repository.

This updates add_to_alternates_file() to take the path to the alternate
object store, including the "/objects" part at the end (earlier, it was
taking the path to $GIT_DIR and was adding "/objects" itself), as it is
technically possible to specify in objects/info/alternates file the path
of a directory whose name does not end with "/objects".

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

git-p4: Add simple test case for branch importVitor Antunes Thu, 18 Aug 2011 23:44:06 +0000 (00:44 +0100)

git-p4: Add simple test case for branch import

Create a basic branch structure in P4 and clone it with git-p4.
Also, make an update on P4 side and check if git-p4 imports it correctly.
The branch structure is created in such a way that git-p4 will fail to import
updates if patch "git-p4: Correct branch base depot path detection" is not
applied.

Signed-off-by: Vitor Antunes <vitor.hda@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

git-p4: Allow branch definition with git configVitor Antunes Thu, 18 Aug 2011 23:44:05 +0000 (00:44 +0100)

git-p4: Allow branch definition with git config

Perforce does not strictly require the usage of branch specifications to create
branches. In these cases the branch detection code of git-p4 will not be able to
import them.
This patch adds support for git-p4.branchList configuration option, allowing
branches to be defined in git config.

Signed-off-by: Vitor Antunes <vitor.hda@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

git-p4: Allow filtering Perforce branches by userVitor Antunes Thu, 18 Aug 2011 23:44:04 +0000 (00:44 +0100)

git-p4: Allow filtering Perforce branches by user

All branches in the Perforce server are downloaded to allow branch detection. If
you have a centralized server on a remote location and there is a big number of
branches this operation can take some time.
This patch adds the configuration option git-p4.branchUser to allow filtering
the branch list by user. Although this limits the branch maintenance in Perforce
to be done by a single user, it might be an advantage when the number of
branches being used in a specific depot is very small when compared with the
branches available in the server.

Signed-off-by: Vitor Antunes <vitor.hda@gmail.com>
Acked-by: Pete Wyckoff <pw@padd.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

git-p4: Correct branch base depot path detectionVitor Antunes Thu, 18 Aug 2011 23:44:03 +0000 (00:44 +0100)

git-p4: Correct branch base depot path detection

When branch detection is enabled each branch is named in git after their
relative depot path in Perforce. To do this the depot paths are compared against
each other to find their common base path. The current algorithm makes this
comparison on a character by character basis.
Assuming we have the following branches:

//depot/branches/featureA
//depot/branches/featureB

Then the base depot path would be //depot/branches/feature, which is an invalid
depot path.

The current patch fixes this by splitting the path into a list and comparing the
list entries, making it choose correctly //depot/branches as the base path.

Signed-off-by: Vitor Antunes <vitor.hda@gmail.com>
Acked-by: Pete Wyckoff <pw@padd.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Merge branch 'maint'Junio C Hamano Tue, 23 Aug 2011 04:02:41 +0000 (21:02 -0700)

Merge branch 'maint'

* maint:
add technical documentation about ref iteration
Do not use C++-style comments

clone: allow more than one --referenceJunio C Hamano Tue, 23 Aug 2011 01:05:15 +0000 (18:05 -0700)

clone: allow more than one --reference

Also add a test to expose a long-standing bug that is triggered when
cloning with --reference option from a local repository that has its own
alternates. The alternate object stores specified on the command line
are lost, and only alternates copied from the source repository remain.
The bug will be fixed in the next patch.

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

Show interpreted branch name in error messagesConrad Irwin Sat, 20 Aug 2011 21:49:49 +0000 (14:49 -0700)

Show interpreted branch name in error messages

Change the error message when doing: "git branch @{-1}",
"git checkout -b @{-1}", or "git branch -m foo @{-1}"

* was: A branch named '@{-1}' already exists.
* now: A branch named 'bar' already exists.

Signed-off-by: Conrad Irwin <conrad.irwin@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Prevent force-updating of the current branchConrad Irwin Sat, 20 Aug 2011 21:49:48 +0000 (14:49 -0700)

Prevent force-updating of the current branch

"git branch -M <foo> <current-branch>" allows updating the current branch
which HEAD points, without the necessary house-keeping that git reset
normally does to make this operation sensible. It also leaves the reflog
in a confusing state (you would be warned when trying to read it).

"git checkout -B <current branch> <foo>" is also partly vulnerable to this
bug; due to inconsistent pre-flight checks it would perform half of its
task and then abort just before rewriting the branch. Again this
manifested itself as the index file getting out-of-sync with HEAD.

"git branch -f" already guarded against this problem, and aborts with
a fatal error.

Update "git branch -M", "git checkout -B" and "git branch -f" to share the
same check before allowing a branch to be created. These prevent you from
updating the current branch.

We considered suggesting the use of "git reset" in the failure message
but concluded that it was not possible to discern what the user was
actually trying to do.

Signed-off-by: Conrad Irwin <conrad.irwin@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

add technical documentation about ref iterationHeiko Voigt Mon, 22 Aug 2011 20:36:45 +0000 (22:36 +0200)

add technical documentation about ref iteration

Signed-off-by: Heiko Voigt <hvoigt@hvoigt.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

clone: allow to clone from .git fileNguyễn Thái Ngọc Duy Sun, 21 Aug 2011 11:58:09 +0000 (18:58 +0700)

clone: allow to clone from .git file

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

read_gitfile_gently(): rename misnamed function to... Junio C Hamano Mon, 22 Aug 2011 21:04:56 +0000 (14:04 -0700)

read_gitfile_gently(): rename misnamed function to read_gitfile()

The function was not gentle at all to the callers and died without giving
them a chance to deal with possible errors. Rename it to read_gitfile(),
and update all the callers.

As no existing caller needs a true "gently" variant, we do not bother
adding one at this point.

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

fast-import: treat cat-blob as a delta base hint for... Dmitry Ivankov Sat, 20 Aug 2011 19:04:12 +0000 (01:04 +0600)

fast-import: treat cat-blob as a delta base hint for next blob

Delta base for blobs is chosen as a previously saved blob. If we
treat cat-blob's blob as a delta base for the next blob, nothing
is likely to become worse.

For fast-import stream producer like svn-fe cat-blob is used like
following:
- svn-fe reads file delta in svn format
- to apply it, svn-fe asks cat-blob 'svn delta base'
- applies 'svn delta' to the response
- produces a blob command to store the result

Currently there is no way for svn-fe to give fast-import a hint on
object delta base. While what's requested in cat-blob is most of
the time a best delta base possible. Of course, it could be not a
good delta base, but we don't know any better one anyway.

So do treat cat-blob's result as a delta base for next blob. The
profit is nice: 2x to 7x reduction in pack size AND 1.2x to 3x
time speedup due to diff_delta being faster on good deltas. git gc
--aggressive can compress it even more, by 10% to 70%, utilizing
more cpu time, real time and 3 cpu cores.

Tested on 213M and 2.7G fast-import streams, resulting packs are 22M
and 113M, import time is 7s and 60s, both streams are produced by
svn-fe, sniffed and then used as raw input for fast-import.

For git-fast-export produced streams there is no change as it doesn't
use cat-blob and doesn't try to reorder blobs in some smart way to
make successive deltas small.

Signed-off-by: Dmitry Ivankov <divanorama@gmail.com>
Acked-by: David Barr <davidbarr@google.com>
Acked-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

fast-import: count and report # of calls to diff_delta... Dmitry Ivankov Sat, 20 Aug 2011 19:04:11 +0000 (01:04 +0600)

fast-import: count and report # of calls to diff_delta in stats

It's an interesting number, how often do we try to deltify each type of
objects and how often do we succeed. So do add it to stats.

Success doesn't mean much gain in pack size though. As we allow delta to
be as big as (data.len - 20). And delta close to data.len gains nothing
compared to no delta at all even after zlib compression (delta is pretty
much the same as data, just with few modifications).

We should try to make less attempts that result in huge deltas as these
consume more cpu than trivial small deltas. Either by choosing a better
delta base or reducing delta size upper bound or doing less delta attempts
at all.

Currently, delta base for blobs is a waste literally. Each blob delta
base is chosen as a previously stored blob. Disabling deltas for blobs
doesn't increase pack size and reduce import time, or at least doesn't
increase time for all fast-import streams I've tried.

Signed-off-by: Dmitry Ivankov <divanorama@gmail.com>
Acked-by: David Barr <davidbarr@google.com>
Acked-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

git-p4: Process detectCopiesHarder with --boolVitor Antunes Mon, 22 Aug 2011 08:33:09 +0000 (09:33 +0100)

git-p4: Process detectCopiesHarder with --bool

Signed-off-by: Vitor Antunes <vitor.hda@gmail.com>
Acked-by: Pete Wyckoff <pw@padd.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

git-p4: Add test case for copy detectionVitor Antunes Mon, 22 Aug 2011 08:33:08 +0000 (09:33 +0100)

git-p4: Add test case for copy detection

Signed-off-by: Vitor Antunes <vitor.hda@gmail.com>
Acked-by: Pete Wyckoff <pw@padd.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

git-p4: Add test case for rename detectionVitor Antunes Mon, 22 Aug 2011 08:33:07 +0000 (09:33 +0100)

git-p4: Add test case for rename detection

Signed-off-by: Vitor Antunes <vitor.hda@gmail.com>
Acked-by: Pete Wyckoff <pw@padd.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

git-p4: Add description of rename/copy detection optionsVitor Antunes Mon, 22 Aug 2011 08:33:06 +0000 (09:33 +0100)

git-p4: Add description of rename/copy detection options

Signed-off-by: Vitor Antunes <vitor.hda@gmail.com>
Acked-by: Pete Wyckoff <pw@padd.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

git-p4: Allow setting rename/copy detection thresholdVitor Antunes Mon, 22 Aug 2011 08:33:05 +0000 (09:33 +0100)

git-p4: Allow setting rename/copy detection threshold

Copy and rename detection arguments (-C and -M) allow setting a threshold value
for the similarity ratio. If the similarity is below this threshold the rename
or copy is ignored and the file is added as new.
This patch allows setting git-p4.detectRenames and git-p4.detectCopies options
to an integer value to set the respective threshold.

Signed-off-by: Vitor Antunes <vitor.hda@gmail.com>
Acked-by: Pete Wyckoff <pw@padd.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Do not use C++-style commentsMichael Haggerty Mon, 22 Aug 2011 10:33:52 +0000 (12:33 +0200)

Do not use C++-style comments

Detected by "gcc -std=iso9899:1990 ...". This patch applies against
"maint".

Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

push: Don't push a repository with unpushed submodulesFredrik Gustafsson Fri, 19 Aug 2011 22:08:47 +0000 (00:08 +0200)

push: Don't push a repository with unpushed submodules

When working with submodules it is easy to forget to push a
submodule to the server but pushing a super-project that
contains a commit for that submodule. The result is that the
superproject points at a submodule commit that is not available
on the server.

This adds the option --recurse-submodules=check to push. When
using this option git will check that all submodule commits that
are about to be pushed are present on a remote of the submodule.

To be able to use a combined diff, disabling a diff callback has
been removed from combined-diff.c.

Signed-off-by: Fredrik Gustafsson <iveqy@iveqy.com>
Mentored-by: Jens Lehmann <Jens.Lehmann@web.de>
Mentored-by: Heiko Voigt <hvoigt@hvoigt.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

combine-diff: support format_callbackJunio C Hamano Sat, 20 Aug 2011 06:32:51 +0000 (23:32 -0700)

combine-diff: support format_callback

This teaches combine-diff machinery to feed a combined merge to a callback
function when DIFF_FORMAT_CALLBACK is specified.

So far, format callback functions are not used for anything but 2-way
diffs. A callback is given a diff_queue_struct, which is an array of
diff_filepair. As its name suggests, a diff_filepair is a _pair_ of
diff_filespec that represents a single preimage and a single postimage.

Since "diff -c" is to compare N parents with a single merge result and
filter out any paths whose result match one (or more) of the parent(s),
its output has to be able to represent N preimages and 1 postimage. For
this reason, a callback function that inspects a diff_filepair that
results from this new infrastructure can and is expected to view the
preimage side (i.e. pair->one) as an array of diff_filespec. Each element
in the array, except for the last one, is marked with "has_more_entries"
bit, so that the same callback function can be used for 2-way diffs and
combined diffs.

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

Use kwset in grepFredrik Kuivinen Sat, 20 Aug 2011 22:42:18 +0000 (00:42 +0200)

Use kwset in grep

Benchmarks for the hot cache case:

before:
$ perf stat --repeat=5 git grep qwerty > /dev/null

Performance counter stats for 'git grep qwerty' (5 runs):

3,478,085 cache-misses # 2.322 M/sec ( +- 2.690% )
11,356,177 cache-references # 7.582 M/sec ( +- 2.598% )
3,872,184 branch-misses # 0.363 % ( +- 0.258% )
1,067,367,848 branches # 712.673 M/sec ( +- 2.622% )
3,828,370,782 instructions # 0.947 IPC ( +- 0.033% )
4,043,832,831 cycles # 2700.037 M/sec ( +- 0.167% )
8,518 page-faults # 0.006 M/sec ( +- 3.648% )
847 CPU-migrations # 0.001 M/sec ( +- 3.262% )
6,546 context-switches # 0.004 M/sec ( +- 2.292% )
1497.695495 task-clock-msecs # 3.303 CPUs ( +- 2.550% )

0.453394396 seconds time elapsed ( +- 0.912% )

after:
$ perf stat --repeat=5 git grep qwerty > /dev/null

Performance counter stats for 'git grep qwerty' (5 runs):

2,989,918 cache-misses # 3.166 M/sec ( +- 5.013% )
10,986,041 cache-references # 11.633 M/sec ( +- 4.899% ) (scaled from 95.06%)
3,511,993 branch-misses # 1.422 % ( +- 0.785% )
246,893,561 branches # 261.433 M/sec ( +- 3.967% )
1,392,727,757 instructions # 0.564 IPC ( +- 0.040% )
2,468,142,397 cycles # 2613.494 M/sec ( +- 0.110% )
7,747 page-faults # 0.008 M/sec ( +- 3.995% )
897 CPU-migrations # 0.001 M/sec ( +- 2.383% )
6,535 context-switches # 0.007 M/sec ( +- 1.993% )
944.384228 task-clock-msecs # 3.177 CPUs ( +- 0.268% )

0.297257643 seconds time elapsed ( +- 0.450% )

So we gain about 35% by using the kwset code.

As a side effect of using kwset two grep tests are fixed by this
patch. The first is fixed because kwset can deal with case-insensitive
search containing NULs, something strcasestr cannot do. The second one
is fixed because we consider patterns containing NULs as fixed strings
(regcomp cannot accept patterns with NULs).

Signed-off-by: Fredrik Kuivinen <frekui@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Use kwset in pickaxeFredrik Kuivinen Sat, 20 Aug 2011 22:41:57 +0000 (00:41 +0200)

Use kwset in pickaxe

Benchmarks in the hot cache case:

before:
$ perf stat --repeat=5 git log -Sqwerty

Performance counter stats for 'git log -Sqwerty' (5 runs):

47,092,744 cache-misses # 2.825 M/sec ( +- 1.607% )
123,368,389 cache-references # 7.400 M/sec ( +- 0.812% )
330,040,998 branch-misses # 3.134 % ( +- 0.257% )
10,530,896,750 branches # 631.663 M/sec ( +- 0.121% )
62,037,201,030 instructions # 1.399 IPC ( +- 0.142% )
44,331,294,321 cycles # 2659.073 M/sec ( +- 0.326% )
96,794 page-faults # 0.006 M/sec ( +- 11.952% )
25 CPU-migrations # 0.000 M/sec ( +- 25.266% )
1,424 context-switches # 0.000 M/sec ( +- 0.540% )
16671.708650 task-clock-msecs # 0.997 CPUs ( +- 0.343% )

16.728692052 seconds time elapsed ( +- 0.344% )

after:
$ perf stat --repeat=5 git log -Sqwerty

Performance counter stats for 'git log -Sqwerty' (5 runs):

51,385,522 cache-misses # 4.619 M/sec ( +- 0.565% )
129,177,880 cache-references # 11.611 M/sec ( +- 0.219% )
319,222,775 branch-misses # 6.946 % ( +- 0.134% )
4,595,913,233 branches # 413.086 M/sec ( +- 0.112% )
31,395,042,533 instructions # 1.062 IPC ( +- 0.129% )
29,558,348,598 cycles # 2656.740 M/sec ( +- 0.204% )
93,224 page-faults # 0.008 M/sec ( +- 4.487% )
19 CPU-migrations # 0.000 M/sec ( +- 10.425% )
950 context-switches # 0.000 M/sec ( +- 0.360% )
11125.796039 task-clock-msecs # 0.997 CPUs ( +- 0.239% )

11.164216599 seconds time elapsed ( +- 0.240% )

So the kwset code is about 33% faster.

Signed-off-by: Fredrik Kuivinen <frekui@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Adapt the kwset code to GitFredrik Kuivinen Sat, 20 Aug 2011 22:41:41 +0000 (00:41 +0200)

Adapt the kwset code to Git

Signed-off-by: Fredrik Kuivinen <frekui@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Add string search routines from GNU grepFredrik Kuivinen Sat, 20 Aug 2011 22:41:11 +0000 (00:41 +0200)

Add string search routines from GNU grep

kwset.c and kwset.h have been copied unmodified from commit e7ac713d^
in the GNU grep git repository (this is the last commit in the
repository licensed under GPLv2).

Signed-off-by: Fredrik Kuivinen <frekui@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Add obstack.[ch] from EGLIBC 2.10Fredrik Kuivinen Sat, 20 Aug 2011 22:40:40 +0000 (00:40 +0200)

Add obstack.[ch] from EGLIBC 2.10

Signed-off-by: Fredrik Kuivinen <frekui@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

support pager.* for external commandsJeff King Thu, 18 Aug 2011 22:01:32 +0000 (15:01 -0700)

support pager.* for external commands

Without this patch, any commands that are not builtin would
not respect pager.* config. For example:

git config pager.stash false
git stash list

would still use a pager. With this patch, pager.stash now
has an effect. If it is not specified, we will still fall
back to pager.log when we invoke "log" from "stash list".

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

want_color: automatically fallback to color.uiJeff King Thu, 18 Aug 2011 05:05:35 +0000 (22:05 -0700)

want_color: automatically fallback to color.ui

All of the "do we want color" flags default to -1 to
indicate that we don't have any color configured. This value
is handled in one of two ways:

1. In porcelain, we check early on whether the value is
still -1 after reading the config, and set it to the
value of color.ui (which defaults to 0).

2. In plumbing, it stays untouched as -1, and want_color
defaults it to off.

This works fine, but means that every porcelain has to check
and reassign its color flag. Now that want_color gives us a
place to put this check in a single spot, we can do that,
simplifying the calling code.

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

diff: don't load color config in plumbingJeff King Thu, 18 Aug 2011 05:05:08 +0000 (22:05 -0700)

diff: don't load color config in plumbing

The diff config callback is split into two functions: one
which loads "ui" config, and one which loads "basic" config.
The former chains to the latter, as the diff UI config is a
superset of the plumbing config.

The color.diff variable is only loaded in the UI config.
However, the basic config actually chains to
git_color_default_config, which loads color.ui. This doesn't
actually cause any bugs, because the plumbing diff code does
not actually look at the value of color.ui.

However, it is somewhat nonsensical, and it makes it
difficult to refactor the color code. It probably came about
because there is no git_color_config to load only color
config, but rather just git_color_default_config, which
loads color config and chains to git_default_config.

This patch splits out the color-specific portion of
git_color_default_config so that the diff UI config can call
it directly. This is perhaps better explained by the
chaining of callbacks. Before we had:

git_diff_ui_config
-> git_diff_basic_config
-> git_color_default_config
-> git_default_config

Now we have:

git_diff_ui_config
-> git_color_config
-> git_diff_basic_config
-> git_default_config

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

config: refactor get_colorbool functionJeff King Thu, 18 Aug 2011 05:04:56 +0000 (22:04 -0700)

config: refactor get_colorbool function

For "git config --get-colorbool color.foo", we use a custom
callback that looks not only for the key that the user gave
us, but also for "diff.color" (for backwards compatibility)
and "color.ui" (as a fallback).

For the former, we use a custom variable to store the
diff.color value. For the latter, though, we store it in the
main "git_use_color_default" variable, turning on color.ui
for any other parts of git that respect this value.

In practice, this doesn't cause any bugs, because git-config
runs without caring about git_use_color_default, and then
exits. But it crosses module boundaries in an unusual and
confusing way, and it makes refactoring color handling
harder than it needs to be.

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

color: delay auto-color decision until point of useJeff King Thu, 18 Aug 2011 05:04:23 +0000 (22:04 -0700)

color: delay auto-color decision until point of use

When we read a color value either from a config file or from
the command line, we use git_config_colorbool to convert it
from the tristate always/never/auto into a single yes/no
boolean value.

This has some timing implications with respect to starting
a pager.

If we start (or decide not to start) the pager before
checking the colorbool, everything is fine. Either isatty(1)
will give us the right information, or we will properly
check for pager_in_use().

However, if we decide to start a pager after we have checked
the colorbool, things are not so simple. If stdout is a tty,
then we will have already decided to use color. However, the
user may also have configured color.pager not to use color
with the pager. In this case, we need to actually turn off
color. Unfortunately, the pager code has no idea which color
variables were turned on (and there are many of them
throughout the code, and they may even have been manipulated
after the colorbool selection by something like "--color" on
the command line).

This bug can be seen any time a pager is started after
config and command line options are checked. This has
affected "git diff" since 89d07f7 (diff: don't run pager if
user asked for a diff style exit code, 2007-08-12). It has
also affect the log family since 1fda91b (Fix 'git log'
early pager startup error case, 2010-08-24).

This patch splits the notion of parsing a colorbool and
actually checking the configuration. The "use_color"
variables now have an additional possible value,
GIT_COLOR_AUTO. Users of the variable should use the new
"want_color()" wrapper, which will lazily determine and
cache the auto-color decision.

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

commit: reduce use of redundant global variablesJunio C Hamano Fri, 19 Aug 2011 18:58:18 +0000 (11:58 -0700)

commit: reduce use of redundant global variables

The file-scope global variable head_sha1[] was used to hold the object
name of the current HEAD commit (unless we are about to make an initial
commit). Also there is an independent "static int initial_commit".

Fix all the functions on the call-chain that use these two variables to
take a new "(const) struct commit *current_head" argument instead, and
replace their uses, e.g. "if (initial_commit)" becomes "if (!current_head)"
and a reference to "head_sha1" becomes "current_head->object.sha1".

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

log: decorate "replaced" on to replaced commitsNguyễn Thái Ngọc Duy Fri, 19 Aug 2011 12:43:50 +0000 (19:43 +0700)

log: decorate "replaced" on to replaced commits

Old code also decorates "new" commits with "refs/replace/SHA1". This
is now gone, but I guess no one will miss it.

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

branch.c: use the parsed branch nameMichael J Gruber Fri, 19 Aug 2011 11:45:43 +0000 (13:45 +0200)

branch.c: use the parsed branch name

When setting up tracking info, branch.c uses the given branch specifier
("name"). Use the parsed name ("ref.buf") instead so that

git branch --set-upstream @{-1} foo

sets up tracking info for the previous branch rather than for a branch
named "@{-1}".

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

mergetools/meld: Use '--output' when availableDavid Aguilar Fri, 19 Aug 2011 09:14:45 +0000 (02:14 -0700)

mergetools/meld: Use '--output' when available

meld 1.5.0 and newer allow the output file to be specified
when merging multiple files. Check whether the meld command
supports '--output' and use it when available.

Signed-off-by: David Aguilar <davvid@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

mergetool--lib: Refactor tools into separate filesDavid Aguilar Thu, 18 Aug 2011 07:23:46 +0000 (00:23 -0700)

mergetool--lib: Refactor tools into separate files

Individual merge tools are now defined in a mergetools/$tool
file which is sourced at runtime.

The individual files are installed into $(git --exec-path)/mergetools/.
New tools can be added by creating a new file instead of editing the
git-mergetool--lib.sh scriptlet.

http://thread.gmane.org/gmane.comp.version-control.git/134906/focus=135006

Signed-off-by: David Aguilar <davvid@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

mergetool--lib: Make style consistent with gitDavid Aguilar Thu, 18 Aug 2011 07:23:45 +0000 (00:23 -0700)

mergetool--lib: Make style consistent with git

Use the predominant conditional style where "then" appears
alone on the line after the test expression.
Remove spaces after ">" output redirections.
Remove unnecessary parentheses around the kdiff3 commands.

Signed-off-by: David Aguilar <davvid@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

difftool--helper: Make style consistent with gitDavid Aguilar Thu, 18 Aug 2011 07:23:44 +0000 (00:23 -0700)

difftool--helper: Make style consistent with git

Use the predominant conditional style where "then" appears
alone on the line after the test expression.

Signed-off-by: David Aguilar <davvid@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Update draft release notes to 1.7.7Junio C Hamano Fri, 19 Aug 2011 05:10:23 +0000 (22:10 -0700)

Update draft release notes to 1.7.7

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

Merge branch 'db/am-skip-blank-at-the-beginning'Junio C Hamano Fri, 19 Aug 2011 05:07:57 +0000 (22:07 -0700)

Merge branch 'db/am-skip-blank-at-the-beginning'

* db/am-skip-blank-at-the-beginning:
am: ignore leading whitespace before patch

Merge branch 'ma/am-exclude'Junio C Hamano Fri, 19 Aug 2011 05:07:54 +0000 (22:07 -0700)

Merge branch 'ma/am-exclude'

* ma/am-exclude:
am: Document new --exclude=<path> option
am: pass exclude down to apply

Merge branch 'maint'Junio C Hamano Fri, 19 Aug 2011 05:06:03 +0000 (22:06 -0700)

Merge branch 'maint'

* maint:
fetch-pack: check for valid commit from server

git_config_colorbool: refactor stdout_is_tty handlingJeff King Thu, 18 Aug 2011 05:03:48 +0000 (22:03 -0700)

git_config_colorbool: refactor stdout_is_tty handling

Usually this function figures out for itself whether stdout
is a tty. However, it has an extra parameter just to allow
git-config to override the auto-detection for its
--get-colorbool option.

Instead of an extra parameter, let's just use a global
variable. This makes calling easier in the common case, and
will make refactoring the colorbool code much simpler.

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

diff: refactor COLOR_DIFF from a flag into an intJeff King Thu, 18 Aug 2011 05:03:12 +0000 (22:03 -0700)

diff: refactor COLOR_DIFF from a flag into an int

This lets us store more than just a bit flag for whether we
want color; we can also store whether we want automatic
colors. This can be useful for making the automatic-color
decision closer to the point of use.

This mostly just involves replacing DIFF_OPT_* calls with
manipulations of the flag. The biggest exception is that
calls to DIFF_OPT_TST must check for "o->use_color > 0",
which lets an "unknown" value (i.e., the default) stay at
"no color". In the previous code, a value of "-1" was not
propagated at all.

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

setup_pager: set GIT_PAGER_IN_USEJeff King Thu, 18 Aug 2011 05:02:29 +0000 (22:02 -0700)

setup_pager: set GIT_PAGER_IN_USE

We have always set a global "spawned_pager" variable when we
start the pager. This lets us make the auto-color decision
later in the program as as "we are outputting to a terminal,
or to a pager which can handle colors".

Commit 6e9af86 added support for the GIT_PAGER_IN_USE
environment variable. An external program calling git (e.g.,
git-svn) could set this variable to indicate that it had
already started the pager, and that the decision about
auto-coloring should take that into account.

However, 6e9af86 failed to do the reverse, which is to tell
external programs when git itself has started the pager.
Thus a git command implemented as an external script that
has the pager turned on (e.g., "git -p stash show") would
not realize it was going to a pager, and would suppress
colors.

This patch remedies that; we always set GIT_PAGER_IN_USE
when we start the pager, and the value is respected by both
this program and any spawned children.

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

t7006: use test_config helpersJeff King Thu, 18 Aug 2011 05:02:06 +0000 (22:02 -0700)

t7006: use test_config helpers

In some cases, this is just making the test script a little
shorter and easier to read. However, there are several
places where we didn't take proper precautions against
polluting downstream tests with our config; this fixes them,
too.

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

test-lib: add helper functions for configJeff King Thu, 18 Aug 2011 05:01:15 +0000 (22:01 -0700)

test-lib: add helper functions for config

There are a few common tasks when working with configuration
variables in tests; this patch aims to make them a little
easier to write and less error-prone.

When setting a variable, you should typically make sure to
clean it up after the test is finished, so as not to pollute
other tests. Like:

test_when_finished 'git config --unset foo.bar' &&
git config foo.bar baz

This patch lets you just write:

test_config foo.bar baz

When clearing a variable that does not exist, git-config
will report a specific non-zero error code. Meaning that
tests which call "git config --unset" often either rely on
the prior tests having actually set it, or must use
test_might_fail. With this patch, the previous:

test_might_fail git config --unset foo.bar

becomes:

test_unconfig foo.bar

Not only is this easier to type, but it is more robust; it
will correctly detect errors from git-config besides "key
was not set".

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

t7006: modernize calls to unsetJeff King Thu, 18 Aug 2011 05:00:47 +0000 (22:00 -0700)

t7006: modernize calls to unset

These tests break &&-chaining to deal with broken "unset"
implementations. Instead, they should just use sane_unset.

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

fetch-pack: check for valid commit from serverNguyễn Thái Ngọc Duy Thu, 18 Aug 2011 13:36:03 +0000 (20:36 +0700)

fetch-pack: check for valid commit from server

A malicious server can return ACK with non-existent SHA-1 or not a
commit. lookup_commit() in this case may return NULL. Do not let
fetch-pack crash by accessing NULL address in this case.

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

log: decorate grafted commits with "grafted"Nguyễn Thái Ngọc Duy Thu, 18 Aug 2011 12:29:37 +0000 (19:29 +0700)

log: decorate grafted commits with "grafted"

In shallow repositories, this may help detect whether a branch ends,
or it is deeper than current depth.

It also show graft points that extend a branch.

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

Move write_shallow_commits to fetch-pack.cNguyễn Thái Ngọc Duy Thu, 18 Aug 2011 12:29:36 +0000 (19:29 +0700)

Move write_shallow_commits to fetch-pack.c

This function produces network traffic and should be in fetch-pack. It
has been in commit.c because it needs to iterate (private) graft
list. It can now do so using for_each_commit_graft().

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

Add for_each_commit_graft() to iterate all graftsNguyễn Thái Ngọc Duy Thu, 18 Aug 2011 12:29:35 +0000 (19:29 +0700)

Add for_each_commit_graft() to iterate all grafts

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

decoration: do not mis-decorate refs with same prefixNguyễn Thái Ngọc Duy Thu, 18 Aug 2011 12:29:34 +0000 (19:29 +0700)

decoration: do not mis-decorate refs with same prefix

We definitely do not want to decorate refs/headsandtails the same as
refs/heads/*, for example.

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

Update draft release notes to 1.7.7Junio C Hamano Thu, 18 Aug 2011 00:48:36 +0000 (17:48 -0700)

Update draft release notes to 1.7.7

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

Merge branch 'mh/check-attr-relative'Junio C Hamano Thu, 18 Aug 2011 00:36:22 +0000 (17:36 -0700)

Merge branch 'mh/check-attr-relative'

* mh/check-attr-relative: (29 commits)
test-path-utils: Add subcommand "prefix_path"
test-path-utils: Add subcommand "absolute_path"
git-check-attr: Normalize paths
git-check-attr: Demonstrate problems with relative paths
git-check-attr: Demonstrate problems with unnormalized paths
git-check-attr: test that no output is written to stderr
Rename git_checkattr() to git_check_attr()
git-check-attr: Fix command-line handling to match docs
git-check-attr: Drive two tests using the same raw data
git-check-attr: Add an --all option to show all attributes
git-check-attr: Error out if no pathnames are specified
git-check-attr: Process command-line args more systematically
git-check-attr: Handle each error separately
git-check-attr: Extract a function error_with_usage()
git-check-attr: Introduce a new variable
git-check-attr: Extract a function output_attr()
Allow querying all attributes on a file
Remove redundant check
Remove redundant call to bootstrap_attr_stack()
Extract a function collect_all_attrs()
...

Merge branch 'js/bisect-no-checkout'Junio C Hamano Thu, 18 Aug 2011 00:36:09 +0000 (17:36 -0700)

Merge branch 'js/bisect-no-checkout'

* js/bisect-no-checkout:
bisect: add support for bisecting bare repositories
bisect: further style nitpicks
bisect: replace "; then" with "\n<tab>*then"
bisect: cleanup whitespace errors in git-bisect.sh.
bisect: add documentation for --no-checkout option.
bisect: add tests for the --no-checkout option.
bisect: introduce --no-checkout support into porcelain.
bisect: introduce support for --no-checkout option.
bisect: add tests to document expected behaviour in presence of broken trees.
bisect: use && to connect statements that are deferred with eval.
bisect: move argument parsing before state modification.

Merge branch 'rc/histogram-diff'Junio C Hamano Thu, 18 Aug 2011 00:36:06 +0000 (17:36 -0700)

Merge branch 'rc/histogram-diff'

* rc/histogram-diff:
xdiff/xhistogram: drop need for additional variable
xdiff/xhistogram: rely on xdl_trim_ends()
xdiff/xhistogram: rework handling of recursed results
xdiff: do away with xdl_mmfile_next()
Make test number unique
xdiff/xprepare: use a smaller sample size for histogram diff
xdiff/xprepare: skip classification
teach --histogram to diff
t4033-diff-patience: factor out tests
xdiff/xpatience: factor out fall-back-diff function
xdiff/xprepare: refactor abort cleanups
xdiff/xprepare: use memset()

Merge branch 'jc/maint-smart-http-race-upload-pack'Junio C Hamano Thu, 18 Aug 2011 00:35:58 +0000 (17:35 -0700)

Merge branch 'jc/maint-smart-http-race-upload-pack'

* jc/maint-smart-http-race-upload-pack:
helping smart-http/stateless-rpc fetch race

Merge branch 'js/sh-style'Junio C Hamano Thu, 18 Aug 2011 00:35:50 +0000 (17:35 -0700)

Merge branch 'js/sh-style'

* js/sh-style:
filter-branch.sh: de-dent usage string
misc-sh: fix up whitespace in some other .sh files.

Merge branch 'js/ref-namespaces'Junio C Hamano Thu, 18 Aug 2011 00:35:38 +0000 (17:35 -0700)

Merge branch 'js/ref-namespaces'

* js/ref-namespaces:
ref namespaces: tests
ref namespaces: documentation
ref namespaces: Support remote repositories via upload-pack and receive-pack
ref namespaces: infrastructure
Fix prefix handling in ref iteration functions

Merge branch 'cb/maint-quiet-push'Junio C Hamano Thu, 18 Aug 2011 00:26:05 +0000 (17:26 -0700)

Merge branch 'cb/maint-quiet-push'

* cb/maint-quiet-push:
receive-pack: do not overstep command line argument array
propagate --quiet to send-pack/receive-pack

Conflicts:
Documentation/git-receive-pack.txt
Documentation/git-send-pack.txt

Merge branch 'jc/maint-combined-diff-work-tree'Junio C Hamano Thu, 18 Aug 2011 00:25:59 +0000 (17:25 -0700)

Merge branch 'jc/maint-combined-diff-work-tree'

* jc/maint-combined-diff-work-tree:
diff -c/--cc: do not mistake "resolved as deletion" as "use working tree"

Conflicts:
combine-diff.c

Merge branch 'cb/maint-exec-error-report'Junio C Hamano Thu, 18 Aug 2011 00:25:55 +0000 (17:25 -0700)

Merge branch 'cb/maint-exec-error-report'

* cb/maint-exec-error-report:
notice error exit from pager
error_routine: use parent's stderr if exec fails

Merge branch 'maint'Junio C Hamano Thu, 18 Aug 2011 00:25:37 +0000 (17:25 -0700)

Merge branch 'maint'

* maint:
checkout-index: remove obsolete comment

Merge branch 'rc/histogram-diff' into HEADJunio C Hamano Thu, 18 Aug 2011 00:17:16 +0000 (17:17 -0700)

Merge branch 'rc/histogram-diff' into HEAD

* rc/histogram-diff:
xdiff/xhistogram: drop need for additional variable
xdiff/xhistogram: rely on xdl_trim_ends()
xdiff/xhistogram: rework handling of recursed results
xdiff: do away with xdl_mmfile_next()
Make test number unique
xdiff/xprepare: use a smaller sample size for histogram diff
xdiff/xprepare: skip classification
teach --histogram to diff
t4033-diff-patience: factor out tests
xdiff/xpatience: factor out fall-back-diff function
xdiff/xprepare: refactor abort cleanups
xdiff/xprepare: use memset()

Conflicts:
xdiff/xprepare.c

xdiff/xprepare: improve O(n*m) performance in xdl_clean... Tay Ray Chuan Wed, 17 Aug 2011 01:53:57 +0000 (09:53 +0800)

xdiff/xprepare: improve O(n*m) performance in xdl_cleanup_records()

In xdl_cleanup_records(), we see O(n*m) performance, where n is the
number of records from xdf->dstart to xdf->dend, and m is the size of a
bucket in xdf->rhash (<= by mlim).

Here, we improve this to O(n) by pre-computing nm (in rcrec->len(1|2))
in xdl_classify_record().

Reported-by: Marat Radchenko <marat@slonopotamus.org>
Signed-off-by: Tay Ray Chuan <rctay89@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

doc/fast-import: document feature import-marks-if-existsDmitry Ivankov Wed, 17 Aug 2011 10:42:58 +0000 (16:42 +0600)

doc/fast-import: document feature import-marks-if-exists

fast-import command-line option --import-marks-if-exists was introduced
in commit dded4f1 (fast-import: Introduce --import-marks-if-exists, 2011-01-15)

--import-marks option can be set via a "feature" command in a fast-import
stream and --import-marks-if-exists had support for such specification
from the very beginning too due to some shared codebase. Though the
documentation for this feature wasn't written in dded4f1.

Add the documentation for "feature import-marks-if-exists=<file>". Also add
a minimalistic test for it.

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

checkout-index: remove obsolete commentNguyễn Thái Ngọc Duy Wed, 17 Aug 2011 12:22:13 +0000 (19:22 +0700)

checkout-index: remove obsolete comment

The first paragraph about flag order is no longer true and is
mentioned in git-checkout-index.txt. The rest is also mentioned in
git-checkout-index.txt.

Remove it and keep uptodate document in one place.

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

Sync with "maint"Junio C Hamano Tue, 16 Aug 2011 21:23:43 +0000 (14:23 -0700)

Sync with "maint"

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

Merge branch 'maint'Junio C Hamano Tue, 16 Aug 2011 21:22:26 +0000 (14:22 -0700)

Merge branch 'maint'

* maint:
Prepare for 1.7.6.1
am: refresh the index at start and --resolved

Conflicts:
GIT-VERSION-GEN
RelNotes

merge-recursive: take advantage of hardcoded empty... Jonathan Nieder Tue, 16 Aug 2011 18:27:39 +0000 (13:27 -0500)

merge-recursive: take advantage of hardcoded empty tree

When this code was first written (v1.4.3-rc1~174^2~4, merge-recur: if
there is no common ancestor, fake empty one, 2006-08-09), everyone
needing a fake empty tree had to make her own, but ever since
v1.5.5-rc0~180^2~1 (2008-02-13), the object lookup machinery provides
a ready-made one. Use it.

This is just a simplification, though it also fixes a small leak
(since the tree in the virtual common ancestor commit is never freed).

Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Prepare for 1.7.6.1Junio C Hamano Tue, 16 Aug 2011 19:13:38 +0000 (12:13 -0700)

Prepare for 1.7.6.1

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

Merge branch 'jk/tag-list-multiple-patterns' into maintJunio C Hamano Tue, 16 Aug 2011 19:41:14 +0000 (12:41 -0700)

Merge branch 'jk/tag-list-multiple-patterns' into maint

* jk/tag-list-multiple-patterns:
tag: accept multiple patterns for --list

Merge branch 'jl/submodule-update-quiet' into maintJunio C Hamano Tue, 16 Aug 2011 19:41:14 +0000 (12:41 -0700)

Merge branch 'jl/submodule-update-quiet' into maint

* jl/submodule-update-quiet:
submodule: update and add must honor --quiet flag

Merge branch 'jl/submodule-add-relurl-wo-upstream'... Junio C Hamano Tue, 16 Aug 2011 19:41:13 +0000 (12:41 -0700)

Merge branch 'jl/submodule-add-relurl-wo-upstream' into maint

* jl/submodule-add-relurl-wo-upstream:
submodule add: clean up duplicated code
submodule add: allow relative repository path even when no url is set
submodule add: test failure when url is not configured in superproject

Conflicts:
git-submodule.sh

Merge branch 'oa/pull-reflog' into maintJunio C Hamano Tue, 16 Aug 2011 19:41:13 +0000 (12:41 -0700)

Merge branch 'oa/pull-reflog' into maint

* oa/pull-reflog:
pull: remove extra space from reflog message

Merge branch 'js/ls-tree-error' into maintJunio C Hamano Tue, 16 Aug 2011 19:41:12 +0000 (12:41 -0700)

Merge branch 'js/ls-tree-error' into maint

* js/ls-tree-error:
Ensure git ls-tree exits with a non-zero exit code if read_tree_recursive fails.
Add a test to check that git ls-tree sets non-zero exit code on error.

Merge branch 'jk/fast-export-quote-path' into maintJunio C Hamano Tue, 16 Aug 2011 19:41:12 +0000 (12:41 -0700)

Merge branch 'jk/fast-export-quote-path' into maint

* jk/fast-export-quote-path:
fast-export: quote paths in output

Merge branch 'jc/checkout-reflog-fix' into maintJunio C Hamano Tue, 16 Aug 2011 19:41:12 +0000 (12:41 -0700)

Merge branch 'jc/checkout-reflog-fix' into maint

* jc/checkout-reflog-fix:
checkout: do not write bogus reflog entry out

Merge branch 'jc/maint-reset-unmerged-path' into maintJunio C Hamano Tue, 16 Aug 2011 18:41:28 +0000 (11:41 -0700)

Merge branch 'jc/maint-reset-unmerged-path' into maint

* jc/maint-reset-unmerged-path:
reset [<commit>] paths...: do not mishandle unmerged paths

Merge branch 'mz/doc-rebase-abort' into maintJunio C Hamano Tue, 16 Aug 2011 18:41:28 +0000 (11:41 -0700)

Merge branch 'mz/doc-rebase-abort' into maint

* mz/doc-rebase-abort:
rebase: clarify "restore the original branch"

Merge branch 'bw/log-all-ref-updates-doc' into maintJunio C Hamano Tue, 16 Aug 2011 18:41:28 +0000 (11:41 -0700)

Merge branch 'bw/log-all-ref-updates-doc' into maint

* bw/log-all-ref-updates-doc:
Documentation: clearly specify what refs are honored by core.logAllRefUpdates

Merge branch 'js/maint-add-path-stat-pwd' into maintJunio C Hamano Tue, 16 Aug 2011 18:41:27 +0000 (11:41 -0700)

Merge branch 'js/maint-add-path-stat-pwd' into maint

* js/maint-add-path-stat-pwd:
get_pwd_cwd(): Do not trust st_dev/st_ino blindly

Merge branch 'ms/help-unknown' into maintJunio C Hamano Tue, 16 Aug 2011 18:41:27 +0000 (11:41 -0700)

Merge branch 'ms/help-unknown' into maint

* ms/help-unknown:
help_unknown_cmd: do not propose an "unknown" cmd

Merge branch 'mz/doc-synopsis-verse' into maintJunio C Hamano Tue, 16 Aug 2011 18:41:26 +0000 (11:41 -0700)

Merge branch 'mz/doc-synopsis-verse' into maint

* mz/doc-synopsis-verse:
Documentation: use [verse] for SYNOPSIS sections

Merge branch 'jn/mime-type-with-params' into maintJunio C Hamano Tue, 16 Aug 2011 18:41:26 +0000 (11:41 -0700)

Merge branch 'jn/mime-type-with-params' into maint

* jn/mime-type-with-params:
gitweb: Serve */*+xml 'blob_plain' as text/plain with $prevent_xss
gitweb: Serve text/* 'blob_plain' as text/plain with $prevent_xss

Merge branch 'jc/submodule-sync-no-auto-vivify' into... Junio C Hamano Tue, 16 Aug 2011 18:41:26 +0000 (11:41 -0700)

Merge branch 'jc/submodule-sync-no-auto-vivify' into maint

* jc/submodule-sync-no-auto-vivify:
submodule add: always initialize .git/config entry
submodule sync: do not auto-vivify uninteresting submodule

Merge branch 'jc/zlib-wrap' into maintJunio C Hamano Tue, 16 Aug 2011 18:23:26 +0000 (11:23 -0700)

Merge branch 'jc/zlib-wrap' into maint

* jc/zlib-wrap:
zlib: allow feeding more than 4GB in one go
zlib: zlib can only process 4GB at a time
zlib: wrap deflateBound() too
zlib: wrap deflate side of the API
zlib: wrap inflateInit2 used to accept only for gzip format
zlib: wrap remaining calls to direct inflate/inflateEnd
zlib wrapper: refactor error message formatter

Merge branch 'fk/relink-upon-ldflags-update' into maintJunio C Hamano Tue, 16 Aug 2011 18:23:26 +0000 (11:23 -0700)

Merge branch 'fk/relink-upon-ldflags-update' into maint

* fk/relink-upon-ldflags-update:
Makefile: Track changes to LDFLAGS and relink when necessary

Merge branch 'bc/submodule-foreach-stdin-fix-1.7.4... Junio C Hamano Tue, 16 Aug 2011 18:23:26 +0000 (11:23 -0700)

Merge branch 'bc/submodule-foreach-stdin-fix-1.7.4' into maint

* bc/submodule-foreach-stdin-fix-1.7.4:
git-submodule.sh: preserve stdin for the command spawned by foreach
t/t7407: demonstrate that the command called by 'submodule foreach' loses stdin

Merge branch 'aw/rebase-i-p' into maintJunio C Hamano Tue, 16 Aug 2011 18:23:25 +0000 (11:23 -0700)

Merge branch 'aw/rebase-i-p' into maint

* aw/rebase-i-p:
rebase -i -p: include non-first-parent commits in todo list

Merge branch 'jc/diff-index-quick-exit-early' into... Junio C Hamano Tue, 16 Aug 2011 18:23:25 +0000 (11:23 -0700)

Merge branch 'jc/diff-index-quick-exit-early' into maint

* jc/diff-index-quick-exit-early:
diff-index --quiet: learn the "stop feeding the backend early" logic

Conflicts:
unpack-trees.h

Merge branch 'jk/combine-diff-binary-etc' into maintJunio C Hamano Tue, 16 Aug 2011 18:23:24 +0000 (11:23 -0700)

Merge branch 'jk/combine-diff-binary-etc' into maint

* jk/combine-diff-binary-etc:
combine-diff: respect textconv attributes
refactor get_textconv to not require diff_filespec
combine-diff: handle binary files as binary
combine-diff: calculate mode_differs earlier
combine-diff: split header printing into its own function

am: refresh the index at start and --resolvedJeff King Tue, 16 Aug 2011 00:13:07 +0000 (17:13 -0700)

am: refresh the index at start and --resolved

If a file is unchanged but stat-dirty, we may erroneously
fail to apply patches, thinking that they conflict with a
dirty working tree.

This patch adds a call to "update-index --refresh". It comes
as late as possible, so that we don't bother with it for
thinks like "git rebase --abort", or when mbox-splitting
fails. However, it does come before we actually start
applying patches, meaning we will only call it once when we
start applying patches (or any time we return to "am" after
having resolved conflicts), and not once per patch.

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

revert: plug memory leak in "cherry-pick root commit... Jonathan Nieder Sun, 14 Aug 2011 15:22:04 +0000 (10:22 -0500)

revert: plug memory leak in "cherry-pick root commit" codepath

The empty tree passed as common ancestor to merge_trees() when
cherry-picking a parentless commit is allocated on the heap and never
freed. Leaking such a small one-time allocation is not a very big
problem, but now that "git cherry-pick" can cherry-pick multiple
commits it can start to add up.

Avoid the leak by storing the fake tree exactly once in the BSS
section (i.e., use a static). While at it, let's add a test to make
sure cherry-picking multiple parentless commits continues to work.

Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Unroll the loop over passesMichael Haggerty Fri, 12 Aug 2011 21:43:10 +0000 (23:43 +0200)

Unroll the loop over passes

The passes no longer share much code, and the unrolled code is easier
to understand.

Use a new index variable instead of num_attr for the second loop, as
we are no longer counting attributes but rather indexing through them.

Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>