gitweb.git
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>

Change while loop into for loopMichael Haggerty Fri, 12 Aug 2011 21:43:09 +0000 (23:43 +0200)

Change while loop into for loop

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

Determine the start of the states outside of the pass... Michael Haggerty Fri, 12 Aug 2011 21:43:08 +0000 (23:43 +0200)

Determine the start of the states outside of the pass loop

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

Change parse_attr() to take a pointer to struct attr_stateMichael Haggerty Fri, 12 Aug 2011 21:43:07 +0000 (23:43 +0200)

Change parse_attr() to take a pointer to struct attr_state

parse_attr() only needs access to the attr_state to which it should
store its results, not to the whole match_attr structure. This change
also removes the need for it to know num_attr. Change its signature
accordingly and add a comment.

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

Increment num_attr in parse_attr_line(), not parse_attr()Michael Haggerty Fri, 12 Aug 2011 21:43:06 +0000 (23:43 +0200)

Increment num_attr in parse_attr_line(), not parse_attr()

num_attr is incremented iff parse_attr() returns non-NULL. So do the
counting in parse_attr_line() instead of within parse_attr(). This
allows an integer rather than a pointer to an integer to be passed to
parse_attr().

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

Document struct match_attrMichael Haggerty Fri, 12 Aug 2011 21:43:05 +0000 (23:43 +0200)

Document struct match_attr

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

Add a file commentMichael Haggerty Fri, 12 Aug 2011 21:43:04 +0000 (23:43 +0200)

Add a file comment

Consolidate here a few general comments plus links to other
documentation. Delete a comment with an out-of-date description of
the .gitattributes file format.

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

fast-import: prevent producing bad deltaDmitry Ivankov Sun, 14 Aug 2011 18:32:24 +0000 (00:32 +0600)

fast-import: prevent producing bad delta

To produce deltas for tree objects fast-import tracks two versions
of tree's entries - base and current one. Base version stands both
for a delta base of this tree, and for a entry inside a delta base
of a parent tree. So care should be taken to keep it in sync.

tree_content_set cuts away a whole subtree and replaces it with a
new one (or NULL for lazy load of a tree with known sha1). It
keeps a base sha1 for this subtree (needed for parent tree). And
here is the problem, 'subtree' tree root doesn't have the implied
base version entries.

Adjusting the subtree to include them would mean a deep rewrite of
subtree. Invalidating the subtree base version would mean recursive
invalidation of parents' base versions. So just mark this tree as
do-not-delta me. Abuse setuid bit for this purpose.

tree_content_replace is the same as tree_content_set except that is
is used to replace the root, so just clearing base sha1 here (instead
of setting the bit) is fine.

[di: log message]

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

fast-import: add a test for tree delta base corruptionDmitry Ivankov Sun, 14 Aug 2011 18:32:23 +0000 (00:32 +0600)

fast-import: add a test for tree delta base corruption

fast-import is able to write imported tree objects in delta format.
It holds a tree structure in memory where each tree entry may have
a delta base sha1 assigned. When delta base data is needed it is
reconstructed from this in-memory structure. Though sometimes the
delta base data doesn't match the delta base sha1 so wrong or even
corrupt pack is produced.

Add a small test that produces a corrupt pack. It uses just tree
copy and file modification commands aside from the very basic commit
and blob commands.

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

merge-recursive: Don't re-sort a list whose order we... Elijah Newren Sat, 13 Aug 2011 02:23:51 +0000 (20:23 -0600)

merge-recursive: Don't re-sort a list whose order we depend upon

In record_df_conflict_files() we would resort the entries list using
df_name_compare to get a convenient ordering. Unfortunately, this broke
assumptions of the get_renames() code (via string_list_lookup() calls)
which needed the list to be in the standard ordering. When those lookups
would fail, duplicate stage_data entries could be inserted, causing the
process_renames and process_entry code to fail (in particular, a path that
that process_renames had marked as processed would still be processed
anyway in process_entry due to the duplicate entry).

Signed-off-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

merge-recursive: Fix virtual merge base for rename... Elijah Newren Fri, 12 Aug 2011 05:20:29 +0000 (23:20 -0600)

merge-recursive: Fix virtual merge base for rename/rename(1to2)/add-dest

Earlier in this series, the patch "merge-recursive: add handling for
rename/rename/add-dest/add-dest" added code to handle the rename on each
side of history also being involved in a rename/add conflict, but only
did so in the non-recursive case. Add code for the recursive case,
ensuring that the "added" files are not simply deleted.

Signed-off-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

t6036: criss-cross + rename/rename(1to2)/add-dest ... Elijah Newren Fri, 12 Aug 2011 05:20:28 +0000 (23:20 -0600)

t6036: criss-cross + rename/rename(1to2)/add-dest + simple modify

This is another testcase trying to exercise the virtual merge base
creation in the rename/rename(1to2) code. A testcase is added that we
should be able to merge cleanly, but which requires a virtual merge base
to be created that correctly handles rename/add-dest conflicts within the
rename/rename(1to2) testcase handling.

Signed-off-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

merge-recursive: Avoid unnecessary file rewritesElijah Newren Fri, 12 Aug 2011 05:20:27 +0000 (23:20 -0600)

merge-recursive: Avoid unnecessary file rewrites

Often times, a potential conflict at a path is resolved by merge-recursive
by using the content that was already present at that location. In such
cases, we do not want to overwrite the content that is already present, as
that could trigger unnecessary recompilations. One of the patches earlier
in this series ("merge-recursive: When we detect we can skip an update,
actually skip it") fixed the cases that involved content merges, but there
were a few other cases as well.

Signed-off-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

t6022: Additional tests checking for unnecessary update... Elijah Newren Fri, 12 Aug 2011 05:20:26 +0000 (23:20 -0600)

t6022: Additional tests checking for unnecessary updates of files

I stumbled across a case, this one not involving a content merge, where
git currently rewrites a file unnecessarily. A quick audit uncovered two
additional situations (also not involving content merges) with the same
problem.

Signed-off-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

merge-recursive: Fix spurious 'refusing to lose untrack... Elijah Newren Fri, 12 Aug 2011 05:20:25 +0000 (23:20 -0600)

merge-recursive: Fix spurious 'refusing to lose untracked file...' messages

Calling update_stages() before update_file() can sometimes result in git
thinking the file being updated is untracked (whenever update_stages
moves it to stage 3). Reverse the call order, and add a big comment to
update_stages to hopefully prevent others from making the same mistake.

Signed-off-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

t6022: Add testcase for spurious "refusing to lose... Elijah Newren Fri, 12 Aug 2011 05:20:24 +0000 (23:20 -0600)

t6022: Add testcase for spurious "refusing to lose untracked" messages

Signed-off-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

t3030: fix accidental success in symlink renameJeff King Fri, 12 Aug 2011 05:20:23 +0000 (23:20 -0600)

t3030: fix accidental success in symlink rename

In this test, we have merge two branches. On one branch, we
renamed "a" to "e". On the other, we renamed "a" to "e" and
then added a symlink pointing at "a" pointing to "e".

The results for the test indicate that the merge should
succeed, but also that "a" should no longer exist. Since
both sides renamed "a" to the same destination, we will end
up comparing those destinations for content.

But what about what's left? One side (the rename only),
replaced "a" with nothing. The other side replaced it with a
symlink. The common base must also be nothing, because any
"a" before this was meaningless (it was totally unrelated
content that ended up getting renamed).

The only sensible resolution is to keep the symlink. The
rename-only side didn't touch the content versus the common
base, and the other side added content. The 3-way merge
dictates that we take the side with a change.

And this gives the overall merge an intuitive result. One
side made one change (a rename), and the other side made two
changes: an identical rename, and an addition (that just
happened to be at the same spot). The end result should
contain both changes.

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

merge-recursive: Fix working copy handling for rename... Elijah Newren Fri, 12 Aug 2011 05:20:22 +0000 (23:20 -0600)

merge-recursive: Fix working copy handling for rename/rename/add/add

If either side of a rename/rename(1to2) conflict is itself also involved
in a rename/add-dest conflict, then we need to make sure both the rename
and the added file appear in the working copy.

Signed-off-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

merge-recursive: add handling for rename/rename/add... Elijah Newren Fri, 12 Aug 2011 05:20:21 +0000 (23:20 -0600)

merge-recursive: add handling for rename/rename/add-dest/add-dest

Each side of the rename in rename/rename(1to2) could potentially also be
involved in a rename/add conflict. Ensure stages for such conflicts are
also recorded.

Signed-off-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

merge-recursive: Have conflict_rename_delete reuse... Elijah Newren Fri, 12 Aug 2011 05:20:20 +0000 (23:20 -0600)

merge-recursive: Have conflict_rename_delete reuse modify/delete code

Signed-off-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

merge-recursive: Make modify/delete handling code reusableElijah Newren Fri, 12 Aug 2011 05:20:19 +0000 (23:20 -0600)

merge-recursive: Make modify/delete handling code reusable

modify/delete and rename/delete share a lot of similarities; we'd like all
the criss-cross and D/F conflict handling specializations to be shared
between the two.

Signed-off-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

merge-recursive: Consider modifications in rename/renam... Elijah Newren Fri, 12 Aug 2011 05:20:18 +0000 (23:20 -0600)

merge-recursive: Consider modifications in rename/rename(2to1) conflicts

Our previous conflict resolution for renaming two different files to the
same name ignored the fact that each of those files may have modifications
from both sides of history to consider. We need to do a three-way merge
for each of those files, and then handle the conflict of both sets of
merged contents trying to be recorded with the same name.

It is important to note that this changes our strategy in the recursive
case. After doing a three-way content merge of each of the files
involved, we still are faced with the fact that we are trying to put both
of the results (including conflict markers) into the same path. We could
do another two-way merge, but I think that becomes confusing. Also,
taking a hint from the modify/delete and rename/delete cases we handled
earlier, a more useful "common ground" would be to keep the three-way
content merge but record it with the original filename. The renames can
still be detected, we just allow it to be done in the o->call_depth=0
case. This seems to result in simpler & easier to understand merge
conflicts as well, as evidenced by some of the changes needed in our
testsuite in t6036. (However, it should be noted that this change will
cause problems those renames also occur along with a file being added
whose name matches the source of the rename. Since git currently cannot
detect rename/add-source situations, though, this codepath is not
currently used for those cases anyway.

Signed-off-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

merge-recursive: Create function for merging with branc... Elijah Newren Fri, 12 Aug 2011 05:20:17 +0000 (23:20 -0600)

merge-recursive: Create function for merging with branchname:file markers

We want to be able to reuse the code to do a three-way file content merge
and have the conflict markers use both branchname and filename. Split it
out into a separate function.

Signed-off-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

merge-recursive: Record more data needed for merging... Elijah Newren Fri, 12 Aug 2011 05:20:16 +0000 (23:20 -0600)

merge-recursive: Record more data needed for merging with dual renames

When two different files are renamed to one, we need to be able to do
three-way merges for both of those files. To do that, we need to record
the sha1sum of the (possibly modified) file on the unrenamed side. Modify
setup_rename_conflict_info() to take this extra information and record it
when the rename_type is RENAME_TWO_FILES_TO_ONE.

Signed-off-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

merge-recursive: Defer rename/rename(2to1) handling... Elijah Newren Fri, 12 Aug 2011 05:20:15 +0000 (23:20 -0600)

merge-recursive: Defer rename/rename(2to1) handling until process_entry

This puts the code for the different types of double rename conflicts
closer together (fewer lines of other code separating the two paths) and
increases similarity between how they are handled.

Signed-off-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

merge-recursive: Small cleanups for conflict_rename_ren... Elijah Newren Fri, 12 Aug 2011 05:20:14 +0000 (23:20 -0600)

merge-recursive: Small cleanups for conflict_rename_rename_1to2

Signed-off-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

merge-recursive: Fix rename/rename(1to2) resolution... Elijah Newren Fri, 12 Aug 2011 05:20:13 +0000 (23:20 -0600)

merge-recursive: Fix rename/rename(1to2) resolution for virtual merge base

When renaming one file to two files, we really should be doing a content
merge. Also, in the recursive case, undoing the renames and recording the
merged file in the index with the source of the rename (while deleting
both destinations) allows the renames to be re-detected in the
non-recursive merge and will result in fewer spurious conflicts.

Signed-off-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

merge-recursive: Introduce a merge_file convenience... Elijah Newren Fri, 12 Aug 2011 05:20:12 +0000 (23:20 -0600)

merge-recursive: Introduce a merge_file convenience function

merge_file previously required diff_filespec arguments, but all callers
only had sha1s and modes. Rename merge_file to merge_file_1 and introduce
a new merge_file convenience function which takes the sha1s and modes and
creates the temporary diff_filespec variables needed to call merge_file_1.

Signed-off-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

merge-recursive: Fix modify/delete resolution in the... Elijah Newren Fri, 12 Aug 2011 05:20:11 +0000 (23:20 -0600)

merge-recursive: Fix modify/delete resolution in the recursive case

When o->call_depth>0 and we have conflicts, we try to find "middle ground"
when creating the virtual merge base. In the case of content conflicts,
this can be done by doing a three-way content merge and using the result.
In all parts where the three-way content merge is clean, it is the correct
middle ground, and in parts where it conflicts there is no middle ground
but the conflict markers provide a good compromise since they are unlikely
to accidentally match any further changes.

In the case of a modify/delete conflict, we cannot do the same thing.
Accepting either endpoint as the resolution for the virtual merge base
runs the risk that when handling the non-recursive case we will silently
accept one person's resolution over another without flagging a conflict.
In this case, the closest "middle ground" we have is actually the merge
base of the candidate merge bases. (We could alternatively attempt a
three way content merge using an empty file in place of the deleted file,
but that seems to be more work than necessary.)

Signed-off-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>