gitweb.git
git-svn: check error code of send_txstreamEric Wong Mon, 1 Sep 2008 02:45:07 +0000 (19:45 -0700)

git-svn: check error code of send_txstream

Not checking the error code of a function used to transform and
send data makes me nervous. It currently returns "undef" on
success; so die if we get any result other than "undef" because
it's likely something went wrong somewhere. I really wish this
function returned an MD5 like send_stream (or better yet, SHA1)
for verification.

Signed-off-by: Eric Wong <normalperson@yhbt.net>

git-svn: Send deltas during commitsFlorian Weimer Sun, 31 Aug 2008 15:47:09 +0000 (17:47 +0200)

git-svn: Send deltas during commits

Signed-off-by: Florian Weimer <fw@deneb.enyo.de>
Acked-by: Eric Wong <normalperson@yhbt.net>

git-svn: Introduce SVN::Git::Editor::_chg_file_get_blobFlorian Weimer Sun, 31 Aug 2008 15:45:04 +0000 (17:45 +0200)

git-svn: Introduce SVN::Git::Editor::_chg_file_get_blob

Signed-off-by: Florian Weimer <fw@deneb.enyo.de>
Acked-by: Eric Wong <normalperson@yhbt.net>

git-svn: extract base blob in generate_diffFlorian Weimer Sun, 31 Aug 2008 15:05:09 +0000 (17:05 +0200)

git-svn: extract base blob in generate_diff

We need the base blob to compute a delta to be sent to the server.

Signed-off-by: Florian Weimer <fw@deneb.enyo.de>
Acked-by: Eric Wong <normalperson@yhbt.net>

diff --dirstat-by-file: count changed files, not linesHeikki Orsila Fri, 5 Sep 2008 19:27:35 +0000 (22:27 +0300)

diff --dirstat-by-file: count changed files, not lines

This new option --dirstat-by-file is the same as --dirstat, but it
counts "impacted files" instead of "impacted lines" (lines that are
added or removed).

Signed-off-by: Heikki Orsila <heikki.orsila@iki.fi>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

merge-recursive: get rid of virtual_idMiklos Vajna Fri, 5 Sep 2008 17:26:42 +0000 (19:26 +0200)

merge-recursive: get rid of virtual_id

We now just leave the object->sha1 field of virtual commits 0{40} as it
is initialized, as a unique hash is not necessary in case of virtual
commits.

Signed-off-by: Miklos Vajna <vmiklos@frugalware.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Mention the fact that 'git annotate' is only for backwa... Junio C Hamano Fri, 5 Sep 2008 07:29:51 +0000 (00:29 -0700)

Mention the fact that 'git annotate' is only for backward compatibility.

When somebody is reading git-blame.txt (or git-annotate.txt) for the first
time, the message we would like to send is:

(1) Here is why you would want to use this command, what it can do
(perhaps more than what you would have expected from "$scm blame"),
and how you tell it to do what it does.

This is obvious.

(2) You might have heard of the command with the other name. There is no
difference between the two, except they differ in their default
output formats.

This is essential to answer: "git has both? how are they different?"

(3) We tend to encourage blame over annotate for new scripts and new
people, but there is no reason to choose one over the other.

This is not as important as (2), but would be useful to avoid
repeated questions about "when will we start deprecating this?"

As long as we describe (2) on git-annotate page clearly enough, people who
read git-blame page first and get curious can refer to git-annotate page.
While at it, subtly hint (3) without being overly explicit.

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

"blame -c" should be compatible with "annotate"Junio C Hamano Fri, 5 Sep 2008 07:57:35 +0000 (00:57 -0700)

"blame -c" should be compatible with "annotate"

There is no reason to have a separate variable cmd_is_annotate;
OUTPUT_ANNOTATE_COMPAT option is supposed to produce the compatibility
output, and we should produce the same output even when the command was
not invoked as "annotate" but as "blame -c".

Noticed by Pasky.

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

merge-recursive: move current_{file,directory}_set... Miklos Vajna Wed, 3 Sep 2008 17:08:56 +0000 (19:08 +0200)

merge-recursive: move current_{file,directory}_set to struct merge_options

Signed-off-by: Miklos Vajna <vmiklos@frugalware.org>

merge-recursive: move the global obuf to struct merge_o... Miklos Vajna Wed, 3 Sep 2008 00:30:03 +0000 (02:30 +0200)

merge-recursive: move the global obuf to struct merge_options

Signed-off-by: Miklos Vajna <vmiklos@frugalware.org>

merge-recursive: get rid of the index_only global variableMiklos Vajna Tue, 2 Sep 2008 21:53:47 +0000 (23:53 +0200)

merge-recursive: get rid of the index_only global variable

struct merge_options already has a call_depth member, and index_only
global variable always equals to !!call_depth.

We always use index_only as a condition, so we can just
use call_depth instead of index_only.

Signed-off-by: Miklos Vajna <vmiklos@frugalware.org>

Merge branch 'jc/maint-log-grep'Junio C Hamano Fri, 5 Sep 2008 05:30:44 +0000 (22:30 -0700)

Merge branch 'jc/maint-log-grep'

* jc/maint-log-grep:
log --author/--committer: really match only with name part
diff --cumulative is a sub-option of --dirstat
bash completion: Hide more plumbing commands

log --author/--committer: really match only with name... Junio C Hamano Fri, 5 Sep 2008 05:15:02 +0000 (22:15 -0700)

log --author/--committer: really match only with name part

When we tried to find commits done by AUTHOR, the first implementation
tried to pattern match a line with "^author .*AUTHOR", which later was
enhanced to strip leading caret and look for "^author AUTHOR" when the
search pattern was anchored at the left end (i.e. --author="^AUTHOR").

This had a few problems:

* When looking for fixed strings (e.g. "git log -F --author=x --grep=y"),
the regexp internally used "^author .*x" would never match anything;

* To match at the end (e.g. "git log --author='google.com>$'"), the
generated regexp has to also match the trailing timestamp part the
commit header lines have. Also, in order to determine if the '$' at
the end means "match at the end of the line" or just a literal dollar
sign (probably backslash-quoted), we would need to parse the regexp
ourselves.

An earlier alternative tried to make sure that a line matches "^author "
(to limit by field name) and the user supplied pattern at the same time.
While it solved the -F problem by introducing a special override for
matching the "^author ", it did not solve the trailing timestamp nor tail
match problem. It also would have matched every commit if --author=author
was asked for, not because the author's email part had this string, but
because every commit header line that talks about the author begins with
that field name, regardleses of who wrote it.

Instead of piling more hacks on top of hacks, this rethinks the grep
machinery that is used to look for strings in the commit header, and makes
sure that (1) field name matches literally at the beginning of the line,
followed by a SP, and (2) the user supplied pattern is matched against the
remainder of the line, excluding the trailing timestamp data.

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

Merge branch 'maint'Shawn O. Pearce Fri, 5 Sep 2008 04:53:06 +0000 (21:53 -0700)

Merge branch 'maint'

* maint:
git-gui: Fix diff parsing for lines starting with "--" or "++"

git-gui: Fix diff parsing for lines starting with ... Shawn O. Pearce Fri, 5 Sep 2008 04:46:56 +0000 (21:46 -0700)

git-gui: Fix diff parsing for lines starting with "--" or "++"

Languages like Lua and SQL use "--" to mark a line as commented out.
If this appears at column 0 and is part of the pre-image we may see
"--- foo" in the diff, indicating that the line whose content is
"-- foo" has been removed from the new version.

git-gui was incorrectly parsing "--- foo" as the old file name
in the file header, causing it to generate a bad patch file when
the user tried to stage or unstage a hunk or the selected line.
We need to keep track of where we are in the parsing so that we do
not misread a deletion or addition record as part of the header.

Reported-by: Alexander Gladysh <agladysh@gmail.com>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>

git-gui: Show special diffs for complex conflict cases.Alexander Gavrilov Sat, 30 Aug 2008 21:05:22 +0000 (01:05 +0400)

git-gui: Show special diffs for complex conflict cases.

Add special handling for displaying diffs of modified/deleted,
and symlink/mode conflicts. Currently the display is completely
unusable for deciding how to resolve the conflict.

New display modes:

1) Deleted/Modified conflict: e.g.
LOCAL: deleted
REMOTE:
[diff :1:$path :3:$path]

2) Conflict involving symlinks:
LOCAL:
[diff :1:$path :2:$path]
REMOTE:
[diff :1:$path :3:$path]

In order to be able to display multiple diffs, this
patch adds a queue of commands to call.

Signed-off-by: Alexander Gavrilov <angavrilov@gmail.com>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>

git-gui: Make F5 reselect a diff, if an untracked file... Alexander Gavrilov Sat, 30 Aug 2008 21:04:10 +0000 (01:04 +0400)

git-gui: Make F5 reselect a diff, if an untracked file is selected.

If an untracked file is selected, F5 and other manual rescan synonyms
would try to select a tracked file instead. Also, clicking on an icon
in the unstaged changes list skips over untracked files, unless the
file clicked is untracked itself.

The objective is to make it easier to ignore untracked files showing
up in the Unstaged Changes list, and ensure that no modifications
to tracked objects are left unstaged.

Signed-off-by: Alexander Gavrilov <angavrilov@gmail.com>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>

git-gui: Reimplement and enhance auto-selection of... Alexander Gavrilov Sat, 30 Aug 2008 21:02:56 +0000 (01:02 +0400)

git-gui: Reimplement and enhance auto-selection of diffs.

Generalize the next_diff system, and implement auto-reselection
for merge tool resolution and reshow_diff. Also add auto-selection
of diffs after rescan, if no diff is already selected.

New auto-select rules:

- Rescan auto-selects the first conflicting file, or if none
a modified tracked file, if nothing was selected previously.
- Resolving a conflict auto-selects the nearest conflicting
file, or nothing if everything is resolved.
- Staging the last remaining hunk auto-selects the nearest
modified staged file.
- Staging a file through its icon auto-selects the nearest file.

Signed-off-by: Alexander Gavrilov <angavrilov@gmail.com>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>

git-gui: Support conflict states _U & UT.Alexander Gavrilov Sat, 30 Aug 2008 21:00:49 +0000 (01:00 +0400)

git-gui: Support conflict states _U & UT.

Support _U (local deleted, remote modified) and
UT (file type changed in conflict) modes.

Note that 'file type changed' does not refer to
changes in the executable bit, instead it denotes
replacing a file with a link, or vice versa.

Signed-off-by: Alexander Gavrilov <angavrilov@gmail.com>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>

git-gui: Support more merge tools.Alexander Gavrilov Sat, 30 Aug 2008 20:59:47 +0000 (00:59 +0400)

git-gui: Support more merge tools.

Add native support for Araxis Merge, WinMerge and Perforce merge.

Custom merge tools are not implemented by mergetool.tcl; besides,
native support allows constructing the command lines in a more
intelligent way.

Signed-off-by: Alexander Gavrilov <angavrilov@gmail.com>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>

git-gui: Don't allow staging files with conflicts.Alexander Gavrilov Sat, 30 Aug 2008 20:54:19 +0000 (00:54 +0400)

git-gui: Don't allow staging files with conflicts.

Prevent staging files with conflict markers by clicking
on the icon in the 'Unstaged Changes' list. Instead, pretend
that the user clicked the name, and show the diff.

Originally it made some sense to allow staging conflicting
files, because git-gui did not provide any tools to resolve
them from within the GUI. But now that we have added mergetool
capabilities, it is more likely to cause accidental and
non-undoable errors.

Signed-off-by: Alexander Gavrilov <angavrilov@gmail.com>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>

git-gui: Support calling merge tools.Alexander Gavrilov Sat, 30 Aug 2008 20:56:51 +0000 (00:56 +0400)

git-gui: Support calling merge tools.

Adds an item to the diff context menu in conflict mode,
which invokes a merge tool for the selected file. Tool
command-line handling code was ported from git-mergetool.

Automatic default tool selection and custom merge tools
are not supported. If merge.tool is not set, git-gui
defaults to meld.

This implementation uses a checkout-index hack in order
to retrieve all stages with autocrlf and filters properly
applied. It requires temporarily moving the original
conflict file out of the way.

Signed-off-by: Alexander Gavrilov <angavrilov@gmail.com>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>

git-gui: Support resolving conflicts via the diff conte... Alexander Gavrilov Sat, 30 Aug 2008 20:55:45 +0000 (00:55 +0400)

git-gui: Support resolving conflicts via the diff context menu.

If the file has merge conflicts, show a special version of the
diff context menu, which includes conflict resolution commands
instead of Stage Hunk/Line. This patch only supports resolving
by discarding all sides except one.

Discarding is the only way to resolve conflicts involving symlinks
and/or deletion, excluding manual editing.

Signed-off-by: Alexander Gavrilov <angavrilov@gmail.com>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>

git-gui: Mark forgotten strings for translation.Christian Stimming Thu, 4 Sep 2008 09:50:53 +0000 (11:50 +0200)

git-gui: Mark forgotten strings for translation.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>

add '%d' pretty format specifier to show decorationRené Scharfe Thu, 4 Sep 2008 21:40:03 +0000 (23:40 +0200)

add '%d' pretty format specifier to show decoration

Add a new format placeholder, %d, which expands to a ref name decoration
(think git log --decorate). It expands to an empty string if the commit
has no decoration, or otherwise to a comma (and space) separated list of
decorations, surrounded by parentheses and a leading space.

Michael Dressel implemented an initial version and chose the letter d,
Junio suggested to add a leading space and parentheses.

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

move load_ref_decorations() to log-tree.c and export itRené Scharfe Thu, 4 Sep 2008 21:39:21 +0000 (23:39 +0200)

move load_ref_decorations() to log-tree.c and export it

log-tree.c is the ideal place for load_ref_decorations() and its
helper functions to live in, because the variable name_decoration
they're operating on is already located there, so move them thither.

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

log: add load_ref_decorations()René Scharfe Thu, 4 Sep 2008 21:38:08 +0000 (23:38 +0200)

log: add load_ref_decorations()

Move the loading of all ref names for decoration into its own function.
A static variable prevents loading twice, because it's quite expensive.
We can do it this way because we currently never unload decorations.

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

Fix AsciiDoc errors in merge documentationJohan Herland Thu, 4 Sep 2008 21:48:48 +0000 (23:48 +0200)

Fix AsciiDoc errors in merge documentation

In the section on conflict markers, the "<<<<<<<" sequence is compiled by
AsciiDoc into invalid XML. A way to resolve this is by inserting something
between the last two characters in that sequence (i.e. between '<' and '"').

This patch encloses the conflict markers in backticks, which renders them
in a monospace font (in the HTML version; the manual page is unaffected),
and with the pleasant side-effect that it also fixes the AsciiDoc compile
problem.

Signed-off-by: Johan Herland <johan@herland.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

diff --cumulative is a sub-option of --dirstatJunio C Hamano Wed, 3 Sep 2008 00:28:59 +0000 (17:28 -0700)

diff --cumulative is a sub-option of --dirstat

The option used to be implemented as if it is a totally independent one,
but "git diff --cumulative" would not mean anything without "--dirstat".

This makes --cumulative imply --dirstat.

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

safe_create_leading_directories(): make it about "leadi... Junio C Hamano Tue, 2 Sep 2008 21:10:15 +0000 (14:10 -0700)

safe_create_leading_directories(): make it about "leading" directories

We used to allow callers to pass "foo/bar/" to make sure both "foo" and
"foo/bar" exist and have good permissions, but this interface is too error
prone. If a caller mistakenly passes a path with trailing slashes
(perhaps it forgot to verify the user input) even when it wants to later
mkdir "bar" itself, it will find that it cannot mkdir "bar". If such a
caller does not bother to check the error for EEXIST, it may even
errorneously die().

Because we have no existing callers to use that obscure feature, this
patch removes it to avoid confusion.

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

bash completion: Hide more plumbing commandsPetr Baudis Tue, 26 Aug 2008 17:11:44 +0000 (19:11 +0200)

bash completion: Hide more plumbing commands

git <tab><tab> still shows way too many commands, some of them
are clearly plumbing. This patch hides the plumbing commands
liberally (that is, in special cases, users still might want to
call one of the hidden commands, a *normal* workflow should never
involve these, though - and if it does, we have a UI problem anyway).

Signed-off-by: Petr Baudis <pasky@suse.cz>
Acked-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

merge-recursive: move call_depth to struct merge_optionsMiklos Vajna Tue, 2 Sep 2008 21:30:09 +0000 (23:30 +0200)

merge-recursive: move call_depth to struct merge_options

Signed-off-by: Miklos Vajna <vmiklos@frugalware.org>

Update draft release notes for 1.6.1Junio C Hamano Wed, 3 Sep 2008 23:27:59 +0000 (16:27 -0700)

Update draft release notes for 1.6.1

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

Merge branch 'maint'Junio C Hamano Wed, 3 Sep 2008 23:08:23 +0000 (16:08 -0700)

Merge branch 'maint'

* maint:
Start 1.6.0.2 maintenance cycle
tests: use "git xyzzy" form (t7200 - t9001)
tests: use "git xyzzy" form (t7000 - t7199)
Fix passwd(5) ref and reflect that commit doens't use commit-tree
improve handling of sideband message display
tests: use "git xyzzy" form (t3600 - t6999)
tests: use "git xyzzy" form (t0000 - t3599)
checkout: fix message when leaving detached HEAD
clone: fix creation of explicitly named target directory
'git foo' program identifies itself without dash in die() messages
setup_git_directory(): fix move to worktree toplevel directory
update-index: fix worktree setup
Start conforming code to "git subcmd" style
read-tree: setup worktree if merge is required
grep: fix worktree setup
diff*: fix worktree setup

Conflicts:
RelNotes
t/t3900-i18n-commit.sh
t/t7003-filter-branch.sh

Start 1.6.0.2 maintenance cycleJunio C Hamano Wed, 3 Sep 2008 22:39:19 +0000 (15:39 -0700)

Start 1.6.0.2 maintenance cycle

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

Merge branch 'nd/worktree' into maintJunio C Hamano Wed, 3 Sep 2008 22:35:37 +0000 (15:35 -0700)

Merge branch 'nd/worktree' into maint

* nd/worktree:
setup_git_directory(): fix move to worktree toplevel directory
update-index: fix worktree setup
read-tree: setup worktree if merge is required
grep: fix worktree setup
diff*: fix worktree setup

Merge branch 'ho/dashless' into maintJunio C Hamano Wed, 3 Sep 2008 21:51:56 +0000 (14:51 -0700)

Merge branch 'ho/dashless' into maint

* ho/dashless:
tests: use "git xyzzy" form (t7200 - t9001)
tests: use "git xyzzy" form (t7000 - t7199)
tests: use "git xyzzy" form (t3600 - t6999)
tests: use "git xyzzy" form (t0000 - t3599)
'git foo' program identifies itself without dash in die() messages
Start conforming code to "git subcmd" style

tests: use "git xyzzy" form (t7200 - t9001)Nanako Shiraishi Wed, 3 Sep 2008 08:59:33 +0000 (17:59 +0900)

tests: use "git xyzzy" form (t7200 - t9001)

Converts tests between t7201-t9001.

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

tests: use "git xyzzy" form (t7000 - t7199)Nanako Shiraishi Wed, 3 Sep 2008 08:59:31 +0000 (17:59 +0900)

tests: use "git xyzzy" form (t7000 - t7199)

Converts tests between t7001-t7103.

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

Fix passwd(5) ref and reflect that commit doens't use... Jonas Fonseca Wed, 3 Sep 2008 08:50:43 +0000 (10:50 +0200)

Fix passwd(5) ref and reflect that commit doens't use commit-tree

Signed-off-by: Jonas Fonseca <fonseca@diku.dk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

improve handling of sideband message displayNicolas Pitre Wed, 3 Sep 2008 19:13:42 +0000 (15:13 -0400)

improve handling of sideband message display

Currently the code looks for line break characters in order to prepend
"remote: " to every line received as many lines can be sent in a single
chunk. However the opposite might happen too, i.e. a single message
line split amongst multiple chunks. This patch adds support for the
later case to avoid displays like:

remote: Compressing objeremote: cts: 100% (313/313), done.

Signed-off-by: Nicolas Pitre <nico@cam.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

tests: use "git xyzzy" form (t3600 - t6999)Nanako Shiraishi Wed, 3 Sep 2008 08:59:29 +0000 (17:59 +0900)

tests: use "git xyzzy" form (t3600 - t6999)

Converts tests between t3600-t6300.

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

tests: use "git xyzzy" form (t0000 - t3599)Nanako Shiraishi Wed, 3 Sep 2008 08:59:27 +0000 (17:59 +0900)

tests: use "git xyzzy" form (t0000 - t3599)

Converts tests between t0050-t3903.

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

checkout: fix message when leaving detached HEADJeff King Wed, 3 Sep 2008 18:07:26 +0000 (14:07 -0400)

checkout: fix message when leaving detached HEAD

The shell version of git checkout would print:

Previous HEAD position was 1234abcd... commit subject line

when leaving a detached HEAD for another commit. Ths C
version attempted to implement this, but got the condition
wrong such that the behavior never triggered.

This patch simplifies the conditions for showing the message
to the ones used by the shell version: any time we are
leaving a detached HEAD and the new and old commits are not
the same (this suppresses it for the "git checkout -b new"
case recommended when you enter the detached state).

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

clone: fix creation of explicitly named target directoryClemens Buchacher Wed, 3 Sep 2008 18:55:55 +0000 (20:55 +0200)

clone: fix creation of explicitly named target directory

'git clone <repo> path/' (note the trailing slash) fails, because the
entire path is interpreted as leading directories. So when mkdir tries to
create the actual path, it already exists.

This makes sure trailing slashes are removed.

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

Merge branch 'tr/filter-branch'Junio C Hamano Wed, 3 Sep 2008 00:47:13 +0000 (17:47 -0700)

Merge branch 'tr/filter-branch'

* tr/filter-branch:
revision --simplify-merges: make it a no-op without pathspec
revision --simplify-merges: do not leave commits unprocessed
revision --simplify-merges: use decoration instead of commit->util field
Documentation: rev-list-options: move --simplify-merges documentation
filter-branch: use --simplify-merges
filter-branch: fix ref rewriting with --subdirectory-filter
filter-branch: Extend test to show rewriting bug
Topo-sort before --simplify-merges
revision traversal: show full history with merge simplification
revision.c: whitespace fix

Merge branch 'np/maint-safer-pack'Junio C Hamano Wed, 3 Sep 2008 00:46:48 +0000 (17:46 -0700)

Merge branch 'np/maint-safer-pack'

* np/maint-safer-pack:
fixup_pack_header_footer(): use nicely aligned buffer sizes
index-pack: use fixup_pack_header_footer()'s validation mode
pack-objects: use fixup_pack_header_footer()'s validation mode
improve reliability of fixup_pack_header_footer()
pack-objects: improve returned information from write_one()

Merge branch 'rf/man-env'Junio C Hamano Wed, 3 Sep 2008 00:45:41 +0000 (17:45 -0700)

Merge branch 'rf/man-env'

* rf/man-env:
builtin-help: fallback to GIT_MAN_VIEWER before man

Merge branch 'jc/author-nickname'Junio C Hamano Wed, 3 Sep 2008 00:45:28 +0000 (17:45 -0700)

Merge branch 'jc/author-nickname'

* jc/author-nickname:
git commit --author=$name: look $name up in existing commits

Merge branch 'dp/pid-uintmax'Junio C Hamano Wed, 3 Sep 2008 00:45:25 +0000 (17:45 -0700)

Merge branch 'dp/pid-uintmax'

* dp/pid-uintmax:
cast pid_t's to uintmax_t to improve portability

gitweb: ref markers link to named shortlogsGiuseppe Bilotta Tue, 2 Sep 2008 19:47:05 +0000 (21:47 +0200)

gitweb: ref markers link to named shortlogs

This patch turns ref markers for tags and heads into links to
appropriate views for the ref name, depending on current context.

For annotated tags, we link to the tag view, unless that's the current
view, in which case we switch to shortlog. For other refs, we prefer the
current view if it's history or (short)log, and default to shortlog
otherwise.

Appropriate changes are made in the CSS to prevent ref markers from
being annoyingly blue and underlined, unless hovered. A visual
indication of the target view difference is also implemented by making
annotated tags show up in italic.

Signed-off-by: Giuseppe Bilotta <giuseppe.bilotta@gmail.com>
Acked-by: Petr Baudis <pasky@suse.cz>
Acked-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Merge branch 'maint'Junio C Hamano Wed, 3 Sep 2008 00:10:08 +0000 (17:10 -0700)

Merge branch 'maint'

* maint:
Makefile: add merge_recursive.h to LIB_H
Improve documentation for --dirstat diff option
Bring local clone's origin URL in line with that of a remote clone
Documentation: minor cleanup in a use case in 'git stash' manual
Documentation: fix disappeared lines in 'git stash' manpage
Documentation: fix reference to a for-each-ref option

t5300: improve SHA1 collision testNicolas Pitre Tue, 2 Sep 2008 14:22:22 +0000 (10:22 -0400)

t5300: improve SHA1 collision test

Make sure the reason for the command failure is actually due to
the detection of SHA1 collision.

Signed-off-by: Nicolas Pitre <nico@cam.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

pack-objects: don't include missing preferred base... Nicolas Pitre Tue, 2 Sep 2008 14:22:21 +0000 (10:22 -0400)

pack-objects: don't include missing preferred base objects

This improves commit 6d6f9cddbe a bit by simply not including missing
bases in the list of objects to process at all.

Signed-off-by: Nicolas Pitre <nico@cam.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

sha1write: don't copy full sized buffersNicolas Pitre Tue, 2 Sep 2008 14:22:20 +0000 (10:22 -0400)

sha1write: don't copy full sized buffers

No need to memcpy() source buffer data when we might just process the
data in place instead of accumulating it into a separate buffer.
This is the case when a whole buffer would have been copied, summed,
written out and then discarded right away.

Also move the CRC32 processing within the loop so the data is more likely
to remain in the L1 CPU cache between the CRC32 sum, SHA1 sum and the
write call.

Signed-off-by: Nicolas Pitre <nico@cam.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Merge branch 'np/maint-safer-pack' into np/packJunio C Hamano Wed, 3 Sep 2008 00:05:44 +0000 (17:05 -0700)

Merge branch 'np/maint-safer-pack' into np/pack

* np/maint-safer-pack:
fixup_pack_header_footer(): use nicely aligned buffer sizes
index-pack: use fixup_pack_header_footer()'s validation mode
pack-objects: use fixup_pack_header_footer()'s validation mode
improve reliability of fixup_pack_header_footer()
pack-objects: improve returned information from write_one()

Makefile: add merge_recursive.h to LIB_HMiklos Vajna Tue, 2 Sep 2008 23:49:05 +0000 (01:49 +0200)

Makefile: add merge_recursive.h to LIB_H

When modifying merge-recursive.h, for example builtin-merge-recursive.c
have to be recompiled which was not true till now, causing various
runtime errors using an incremental build.

Signed-off-by: Miklos Vajna <vmiklos@frugalware.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

cherry-pick/revert: make direct internal call to merge_... Miklos Vajna Tue, 2 Sep 2008 21:11:15 +0000 (14:11 -0700)

cherry-pick/revert: make direct internal call to merge_tree()

Refactored merge-recursive interface may still not be ideal but it already
allows us to make a direct call to merge_tree().

One regression is that the status message is lost as there is no way to
flush them from outside the refactored library code yet.

[jc: initial version by Miklos, with moderate amount of fixup by me]

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

Improve documentation for --dirstat diff optionHeikki Orsila Mon, 1 Sep 2008 00:50:28 +0000 (03:50 +0300)

Improve documentation for --dirstat diff option

Signed-off-by: Heikki Orsila <heikki.orsila@iki.fi>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Bring local clone's origin URL in line with that of... Johan Herland Mon, 1 Sep 2008 19:07:33 +0000 (21:07 +0200)

Bring local clone's origin URL in line with that of a remote clone

On a local clone, "git clone" would use the fully DWIMmed path as the origin
URL in the resulting repo. This was slightly inconsistent with the case of a
remote clone where the _given_ URL was used as the origin URL (because the
DWIMming was done remotely, and was therefore not available to "git clone").

This behaviour caused problems when cloning a local non-bare repo with
relative submodule URLs, because these submodule URLs would then be resolved
against the DWIMmed URL (e.g. "/repo/.git") instead of the given URL (e.g.
"/repo").

This patch teaches "git clone" to use the _given_ URL - instead of the
DWIMmed path - as the origin URL. This causes relative submodule URLs to be
resolved correctly, as long the _given_ URL indicates the correct directory
against which the submodule URLs should be resolved.

The patch also updates a testcase that contained the old-style origin URLs.

Signed-off-by: Johan Herland <johan@herland.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Documentation: minor cleanup in a use case in 'git... SZEDER Gábor Tue, 2 Sep 2008 01:45:01 +0000 (03:45 +0200)

Documentation: minor cleanup in a use case in 'git stash' manual

There is no need to explicitly pass the file to be committed to 'git
commit', because it's contents is already in the index.

Signed-off-by: SZEDER Gábor <szeder@ira.uka.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Documentation: fix disappeared lines in 'git stash... SZEDER Gábor Tue, 2 Sep 2008 01:35:24 +0000 (03:35 +0200)

Documentation: fix disappeared lines in 'git stash' manpage

Asciidoc removes lines starting with a dot when creating manpages.
Since those lines were comments in use case examples showing shell
commands, preceed those lines with a hash sign.

Signed-off-by: SZEDER Gábor <szeder@ira.uka.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Documentation: fix reference to a for-each-ref optionSZEDER Gábor Mon, 1 Sep 2008 21:02:09 +0000 (23:02 +0200)

Documentation: fix reference to a for-each-ref option

... to match the synopsis section

Signed-off-by: SZEDER Gábor <szeder@ira.uka.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Merge branch 'maint'Shawn O. Pearce Mon, 1 Sep 2008 22:39:56 +0000 (15:39 -0700)

Merge branch 'maint'

* maint:
git-gui: Fix string escaping in po2msg.sh
git gui: show diffs with a minimum of 1 context line

Conflicts:
lib/option.tcl

git-gui: Fix string escaping in po2msg.shAlexander Gavrilov Sat, 30 Aug 2008 21:12:26 +0000 (01:12 +0400)

git-gui: Fix string escaping in po2msg.sh

Escape '$', because otherwise git-gui crashes while
trying to load malformed Japanese localization strings.

Signed-off-by: Alexander Gavrilov <angavrilov@gmail.com>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>

git gui: show diffs with a minimum of 1 context lineClemens Buchacher Sat, 30 Aug 2008 16:45:27 +0000 (18:45 +0200)

git gui: show diffs with a minimum of 1 context line

Staging hunks without context does not work, because line number
information would have to be recomputed for individual hunks.

Since it is already possible to stage individual lines using
'Stage Line for Commit', zero context diffs are not really
necessary for git gui.

Signed-off-by: Clemens Buchacher <drizzd@aon.at>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>

git-merge documentation: describe how conflict is presentedJunio C Hamano Mon, 1 Sep 2008 03:36:32 +0000 (20:36 -0700)

git-merge documentation: describe how conflict is presented

We took it granted that everybody knows how to read the RCS merge style
conflicts, and did not give illustrations in the documentation. Now we
are introducing an alternative output style, it is time to document this.

The lack of illustration has been bugging me for a long time.

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

checkout --conflict=<style>: recreate merge in a non... Junio C Hamano Mon, 1 Sep 2008 02:32:40 +0000 (19:32 -0700)

checkout --conflict=<style>: recreate merge in a non-default style

This new option does essentially the same thing as -m option when checking
unmerged paths out of the index, but it uses the specified style instead
of configured merge.conflictstyle.

Setting "merge.conflictstyle" to "diff3" is usually less useful than using
the default "merge" style, because the latter allows a conflict that
results by both sides changing the same region in a very similar way to
get simplified substancially by reducing the common lines. However, when
one side removed a group of lines (perhaps a function was moved to some
other file) while the other side modified it, the default "merge" style
does not give any clue as to why the hunk is left conflicting. You would
need the original to understand what is going on.

The recommended use would be not to set merge.conflictstyle variable so
that you would usually use the default "merge" style conflict, and when
the result in a path in a particular merge is too hard to understand, use
"git checkout --conflict=diff3 $path" to check it out with the original to
review what is going on.

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

Merge branch 'tr/rev-list-docs' into tr/filter-branchJunio C Hamano Sun, 31 Aug 2008 17:41:01 +0000 (10:41 -0700)

Merge branch 'tr/rev-list-docs' into tr/filter-branch

This prepares the necessary parts to merge filter-branch
fix based on simplify-merges to master.

cast pid_t's to uintmax_t to improve portabilityDavid Soria Parra Sun, 31 Aug 2008 12:09:39 +0000 (14:09 +0200)

cast pid_t's to uintmax_t to improve portability

Some systems (like e.g. OpenSolaris) define pid_t as long,
therefore all our sprintf that use %i/%d cause a compiler warning
beacuse of the implicit long->int cast. To make sure that
we fit the limits, we display pids as PRIuMAX and cast them explicitly
to uintmax_t.

Signed-off-by: David Soria Parra <dsp@php.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Merge branch 'maint'Junio C Hamano Sun, 31 Aug 2008 23:52:53 +0000 (16:52 -0700)

Merge branch 'maint'

* maint:
Document sendemail.envelopesender configuration
Document clarification: gitmodules, gitattributes
config.txt: Add missing colons after option name

t6013: replace use of 'tac' with equivalent PerlThomas Rast Sun, 31 Aug 2008 22:31:37 +0000 (00:31 +0200)

t6013: replace use of 'tac' with equivalent Perl

'tac' is not available everywhere, so substitute the equivalent Perl
code 'print reverse <>'. Noticed by Brian Gernhardt.

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

Document sendemail.envelopesender configurationAsk Bjørn Hansen Sun, 31 Aug 2008 20:32:43 +0000 (13:32 -0700)

Document sendemail.envelopesender configuration

Signed-off-by: Ask Bjørn Hansen <ask@develooper.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Document clarification: gitmodules, gitattributesGustaf Hendeby Sun, 31 Aug 2008 16:00:27 +0000 (18:00 +0200)

Document clarification: gitmodules, gitattributes

The SYNOPSIS section of gitattibutes and gitmodule fail to clearly
specify the name of the in tree files used. This patch brings in the
initial `.' and the fact that the `.gitmodules' file should reside at
the top-level of the working tree.

Signed-off-by: Gustaf Hendeby <hendeby@isy.liu.se>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

git-add --intent-to-add (-N)Junio C Hamano Thu, 21 Aug 2008 08:44:53 +0000 (01:44 -0700)

git-add --intent-to-add (-N)

This adds "--intent-to-add" option to "git add". This is to let the
system know that you will tell it the final contents to be staged later,
iow, just be aware of the presense of the path with the type of the blob
for now. It is implemented by staging an empty blob as the content.

With this sequence:

$ git reset --hard
$ edit newfile
$ git add -N newfile
$ edit newfile oldfile
$ git diff

the diff will show all changes relative to the current commit. Then you
can do:

$ git commit -a ;# commit everything

or

$ git commit oldfile ;# only oldfile, newfile not yet added

to pretend you are working with an index-free system like CVS.

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

Add help.autocorrect to enable/disable autocorrectingAlex Riesen Sun, 31 Aug 2008 13:54:58 +0000 (15:54 +0200)

Add help.autocorrect to enable/disable autocorrecting

It is off(0) by default, to avoid scaring people unless they asked to.
If set to a non-0 value, wait for that amount of deciseconds before
running the corrected command.

Suggested by Junio, so he has a chance to hit Ctrl-C.

Signed-off-by: Alex Riesen <raa.lkml@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

git wrapper: DWIM mistyped commandsJohannes Schindelin Sun, 31 Aug 2008 13:50:23 +0000 (15:50 +0200)

git wrapper: DWIM mistyped commands

This patch introduces a modified Damerau-Levenshtein algorithm into
Git's code base, and uses it with the following penalties to show some
similar commands when an unknown command was encountered:

swap = 0, insertion = 1, substitution = 2, deletion = 4

A typical output would now look like this:

$ git sm
git: 'sm' is not a git-command. See 'git --help'.

Did you mean one of these?
am
rm

The cut-off is at similarity rating 6, which was empirically determined
to give sensible results.

As a convenience, if there is only one candidate, Git continues under
the assumption that the user mistyped it. Example:

$ git reabse
WARNING: You called a Git program named 'reabse', which does
not exist.
Continuing under the assumption that you meant 'rebase'
[...]

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

'git foo' program identifies itself without dash in... Junio C Hamano Sun, 31 Aug 2008 16:39:19 +0000 (09:39 -0700)

'git foo' program identifies itself without dash in die() messages

This is a mechanical conversion of all '*.c' files with:

s/((?:die|error|warning)\("git)-(\S+:)/$1 $2/;

The result was manually inspected and no false positive was found.

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

setup_git_directory(): fix move to worktree toplevel... Nguyễn Thái Ngọc Duy Sat, 30 Aug 2008 09:15:32 +0000 (16:15 +0700)

setup_git_directory(): fix move to worktree toplevel directory

When setup_git_directory() returns successfully, it is supposed to move
current working directory to worktree toplevel directory.

However, the code recomputing prefix inside setup_git_directory() has
to move cwd back to original working directory, in order to get new
prefix. After that, it should move cwd back to worktree toplevel
directory as expected.

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

update-index: fix worktree setupNguyễn Thái Ngọc Duy Sat, 30 Aug 2008 09:13:58 +0000 (16:13 +0700)

update-index: fix worktree setup

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

config.txt: Add missing colons after option nameTeemu Likonen Fri, 29 Aug 2008 07:29:42 +0000 (10:29 +0300)

config.txt: Add missing colons after option name

gitcvs.usecrlfattr --> gitcvs.usecrlfattr::

This fixes an asciidoc markup issue.

Signed-off-by: Teemu Likonen <tlikonen@iki.fi>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

git commit --author=$name: look $name up in existing... Junio C Hamano Wed, 27 Aug 2008 06:13:13 +0000 (23:13 -0700)

git commit --author=$name: look $name up in existing commits

This allows "git commit --author=$name" to accept a name that is not in
the required "A U Thor <author@example.xz>" format, and use that to look
up an author name that matches from existing commits.

When using this feature, it is the user's responsibility to give a name
that uniquely matches the name s/he wants, as the logic returns the name
from the first matching commit.

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

diff: vary default prefix depending on what are comparedJunio C Hamano Tue, 19 Aug 2008 03:08:09 +0000 (20:08 -0700)

diff: vary default prefix depending on what are compared

With a new configuration "diff.mnemonicprefix", "git diff" shows the
differences between various combinations of preimage and postimage trees
with prefixes different from the standard "a/" and "b/". Hopefully this
will make the distinction stand out for some people.

"git diff" compares the (i)ndex and the (w)ork tree;
"git diff HEAD" compares a (c)ommit and the (w)ork tree;
"git diff --cached" compares a (c)ommit and the (i)ndex;
"git-diff HEAD:file1 file2" compares an (o)bject and a (w)ork tree entity;
"git diff --no-index a b" compares two non-git things (1) and (2).

Because these mnemonics now have meanings, they are swapped when reverse
diff is in effect and this feature is enabled.

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

builtin-merge: avoid run_command_v_opt() for recursive... Miklos Vajna Thu, 28 Aug 2008 13:43:00 +0000 (15:43 +0200)

builtin-merge: avoid run_command_v_opt() for recursive and subtree

The try_merge_strategy() function always ran the strategy in a separate
process, though this is not always necessary. The recursive and subtree
strategy can be called without a fork(). This patch adds a check, and
calls recursive in the same process without wasting resources.

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

merge-recursive: introduce merge_optionsMiklos Vajna Mon, 25 Aug 2008 14:25:57 +0000 (16:25 +0200)

merge-recursive: introduce merge_options

This makes it possible to avoid passing the labels of branches as
arguments to merge_recursive(), merge_trees() and
merge_recursive_generic().

It also takes care of subtree merge, output buffering, verbosity, and
rename limits - these were global variables till now in
merge-recursive.c.

A new function, named init_merge_options(), is introduced as well, it
clears the struct merge_info, then initializes with default values,
finally updates the default values based on the config and environment
variables.

Signed-off-by: Miklos Vajna <vmiklos@frugalware.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

merge-recursive.c: Add more generic merge_recursive_gen... Stephan Beyer Tue, 12 Aug 2008 20:13:59 +0000 (22:13 +0200)

merge-recursive.c: Add more generic merge_recursive_generic()

merge_recursive_generic() takes, in comparison to to merge_recursive(),
no commit ("struct commit *") arguments but SHA ids ("unsigned char *"),
and no commit list of bases but an array of refs ("const char **").

This makes it more generic in the case that it can also take the SHA
of a tree to merge trees without commits, for the bases, the head
and the remote.

merge_recursive_generic() also handles locking and updating of the
index, which is a common use case of merge_recursive().

This patch also rewrites builtin-merge-recursive.c to make use of
merge_recursive_generic(). By doing this, I stumbled over the
limitation of 20 bases and I've added a warning if this limitation
is exceeded.

This patch qualifies make_virtual_commit() as static again because
this function is not needed anymore outside merge-recursive.c.

Signed-off-by: Stephan Beyer <s-beyer@gmx.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Split out merge_recursive() to merge-recursive.cMiklos Vajna Tue, 12 Aug 2008 16:45:14 +0000 (18:45 +0200)

Split out merge_recursive() to merge-recursive.c

Move most of the of code from builtin-merge-recursive.c to a new file
merge-recursive.c and introduce merge_recursive_setup() in there so that
builtin-merge-recursive and other builtins call it.

Signed-off-by: Miklos Vajna <vmiklos@frugalware.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

diff: Help "less" hide ^M from the outputJunio C Hamano Thu, 28 Aug 2008 02:48:01 +0000 (19:48 -0700)

diff: Help "less" hide ^M from the output

When the tracked contents have CRLF line endings, colored diff output
shows "^M" at the end of output lines, which is distracting, even though
the pager we use by default ("less") knows to hide them.

The problem is that "less" hides a carriage-return only at the end of the
line, immediately before a line feed. The colored diff output does not
take this into account, and emits four element sequence for each line:

- force this color;
- the line up to but not including the terminating line feed;
- reset color
- line feed.

By including the carriage return at the end of the line in the second
item, we are breaking the smart our pager has in order not to show "^M".
This can be fixed by changing the sequence to:

- force this color;
- the line up to but not including the terminating end-of-line;
- reset color
- end-of-line.

where end-of-line is either a single linefeed or a CRLF pair. When the
output is not colored, "force this color" and "reset color" sequences are
both empty, so we won't have this problem with or without this patch.

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

Merge branch 'maint'Junio C Hamano Sun, 31 Aug 2008 03:31:39 +0000 (20:31 -0700)

Merge branch 'maint'

* maint:
gitattributes: -crlf is not binary
git-apply: Loosen "match_beginning" logic
Fix example in git-name-rev documentation
shell: do not play duplicated definition games to shrink the executable
Fix use of hardlinks in "make install"
pack-objects: Allow missing base objects when creating thin packs

gitattributes: -crlf is not binaryJunio C Hamano Sat, 30 Aug 2008 21:35:15 +0000 (14:35 -0700)

gitattributes: -crlf is not binary

The description of crlf attribute incorrectly said that "-crlf" means
binary. It is true that for binary files you would want "-crlf", but
that is not the same thing.

We also have supported attribute macros and via that mechanism a handy
"binary" to specify "-crlf -diff" at the same time. It was not documented
anywhere as far as I can tell, even though the support was there from
the very beginning.

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

checkout -m: recreate merge when checking out of unmerg... Junio C Hamano Sat, 30 Aug 2008 14:52:24 +0000 (07:52 -0700)

checkout -m: recreate merge when checking out of unmerged index

This teaches git-checkout to recreate a merge out of unmerged
index entries while resolving conflicts.

With this patch, checking out an unmerged path from the index
now have the following possibilities:

* Without any option, an attempt to checkout an unmerged path
will atomically fail (i.e. no other cleanly-merged paths are
checked out either);

* With "-f", other cleanly-merged paths are checked out, and
unmerged paths are ignored;

* With "--ours" or "--theirs, the contents from the specified
stage is checked out;

* With "-m" (we should add "--merge" as synonym), the 3-way merge
is recreated from the staged object names and checked out.

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

Merge branch 'jc/maint-checkout-fix' into 'jc/better... Junio C Hamano Sun, 31 Aug 2008 02:44:17 +0000 (19:44 -0700)

Merge branch 'jc/maint-checkout-fix' into 'jc/better-conflict-resolution'

* jc/maint-checkout-fix:
checkout --ours/--theirs: allow checking out one side of a conflicting merge
checkout -f: allow ignoring unmerged paths when checking out of the index
checkout: do not check out unmerged higher stages randomly

git-merge-recursive: learn to honor merge.conflictstyleJunio C Hamano Fri, 29 Aug 2008 17:59:16 +0000 (10:59 -0700)

git-merge-recursive: learn to honor merge.conflictstyle

This teaches the low-level ll_xdl_merge() routine to honor
merge.conflictstyle configuration variable, so that merge-recursive
strategy can show the conflicts in the style of user's choice.

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

merge.conflictstyle: choose between "merge" and "diff3... Junio C Hamano Fri, 29 Aug 2008 17:49:56 +0000 (10:49 -0700)

merge.conflictstyle: choose between "merge" and "diff3 -m" styles

This teaches "git merge-file" to honor merge.conflictstyle configuration
variable, whose value can be "merge" (default) or "diff3".

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

rerere: understand "diff3 -m" style conflicts with... Junio C Hamano Fri, 29 Aug 2008 17:24:45 +0000 (10:24 -0700)

rerere: understand "diff3 -m" style conflicts with the original

This teaches rerere to grok conflicts expressed in "diff3 -m" style
output, where the version from the common ancestor is output after the
first side, preceded by a "|||||||" line.

The rerere database needs to keep only the versions from two sides, so the
code parses the original copy and discards it.

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

rerere.c: use symbolic constants to keep track of parsi... Junio C Hamano Fri, 29 Aug 2008 17:12:23 +0000 (10:12 -0700)

rerere.c: use symbolic constants to keep track of parsing states

These hardcoded integers make the code harder to follow than necessary;
replace them with enums to make it easier to read, before adding support
for optionally parsing "diff3 -m" style conflict markers.

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

xmerge.c: "diff3 -m" style clips merge reduction level... Junio C Hamano Fri, 29 Aug 2008 15:22:55 +0000 (08:22 -0700)

xmerge.c: "diff3 -m" style clips merge reduction level to EAGER or less

When showing a conflicting merge result, and "--diff3 -m" style is asked
for, this patch makes sure that the merge reduction level does not exceed
XDL_MERGE_EAGER. This is because "diff3 -m" style output would not make
sense for anything more aggressive than XDL_MERGE_EAGER, because of the
way how the merge reduction works.

"git merge-file" no longer has to force MERGE_EAGER when "--diff3" is
asked for because of this change.

Suppose a common ancestor (shared preimage) is modified to postimage #1
and #2 (each letter represents one line):

#####
postimage#1: 1234ABCDE789
| /
| /
preimage: 123456789
| \
postimage#2: 1234AXYE789
####

XDL_MERGE_MINIMAL and XDL_MERGE_EAGER would:

(1) find the s/56/ABCDE/ done on one side and s/56/AXYE/ done on the
other side,

(2) notice that they touch an overlapping area, and

(3) mark it as a conflict, "ABCDE vs AXYE".

The difference between the two algorithms is that EAGER drops the hunk
altogether if the postimages match (i.e. both sides modified the same
way), while MINIMAL keeps it. There is no other operation performed to
the hunk. As the result, lines marked with "#" in the above picure will
be in the RCS merge style output like this (letters <, = and > represent
conflict marker lines):

output: 1234<ABCDE=AXYE>789 ; with MINIMAL/EAGER

The part from the preimage that corresponds to these conflicting changes
is "56", which is what "diff3 -m" style output adds to it:

output: 1234<ABCDE|56=AXYE>789 ; in "diff3 -m" style

Now, XDL_MERGE_ZEALOUS looks at the differences between the changes two
postimages made in order to reduce the number of lines in the conflicting
regions. It notices that both sides start their new contents with "A",
and excludes it from the output (it also excludes "E" for the same
reason). The conflict that used to be "ABCDE vs AXYE" is now "BCD vs XY":

output: 1234A<BCD=XY>E789 ; with ZEALOUS

There could even be matching parts between two postimages in the middle.
Instead of one side rewriting the shared "56" to "ABCDE" and the other
side to "AXYE", imagine the case where the postimages are "ABCDE" and
"AXCYE", in which case instead of having one conflicted hunk "BCD vs XY",
you would have two conflicting hunks "B vs X" and "D vs Y".

In either case, once you reduce "ABCDE vs AXYE" to "BCD vs XY" (or "ABCDE
vs AXCYE" to "B vs X" and "D vs Y"), there is no part from the preimage
that corresponds to the conflicting change made in both postimages
anymore. In other words, conflict reduced by ZEALOUS algorithm cannot be
expressed in "diff3 -m" style. Representing the last illustration like
this is misleading to say the least:

output: 1234A<BCD|56=XY>E789 ; broken "diff3 -m" style

because the preimage was not ...4A56E... to begin with. "A" and "E" are
common only between the postimages.

Even worse, once a single conflicting hunk is split into multiple ones
(recall the example of breaking "ABCDE vs AXCYE" to "B vs X" and "D vs
Y"), there is no sane way to distribute the preimage text across split
conflicting hunks.

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

xmerge.c: minimum readability fixupsJunio C Hamano Fri, 29 Aug 2008 15:16:30 +0000 (08:16 -0700)

xmerge.c: minimum readability fixups

This replaces hardcoded magic constants with symbolic ones for
readability, and swaps one if/else blocks to better match the
order in which 0/1/2 variables are handled to nearby codepath.

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

xdiff-merge: optionally show conflicts in "diff3 -m... Junio C Hamano Thu, 28 Aug 2008 08:10:04 +0000 (01:10 -0700)

xdiff-merge: optionally show conflicts in "diff3 -m" style

When showing conflicting merges, we traditionally followed RCS's merge
output format. The output shows:

<<<<<<<
postimage from one side;
=======
postimage of the other side; and
>>>>>>>

Some poeple find it easier to be able to understand what is going on when
they can view the common ancestor's version, which is used by "diff3 -m",
which shows:

<<<<<<<
postimage from one side;
|||||||
shared preimage;
=======
postimage of the other side; and
>>>>>>>

This is an initial step to bring that as an optional feature to git.
Only "git merge-file" has been converted, with "--diff3" option.

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

xdl_fill_merge_buffer(): separate out a too deeply... Junio C Hamano Thu, 28 Aug 2008 08:04:00 +0000 (01:04 -0700)

xdl_fill_merge_buffer(): separate out a too deeply nested function

This simply moves code around to make a separate function that prepares
a single conflicted hunk with markers into the buffer.

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