gitweb.git
revert: clarify label on conflict hunksJonathan Nieder Sun, 21 Mar 2010 00:45:21 +0000 (19:45 -0500)

revert: clarify label on conflict hunks

When reverting a commit, the commit being merged is not the commit
to revert itself but its parent. Add “parent of” to the conflict
hunk label to make this more clear.

The conflict hunk labels are all pieces of a single string written in
the new get_message() function. Avoid some complication by using
mempcpy to advance a pointer as the result is written.

Also free the corresponding temporary buffer (it was leaked before).
This is not important because it is a small one-time allocation. It
would become a memory leak if unnoticed when libifying revert.

This patch uses calls to strlen() instead of integer constants in some
places. GCC will compute the length at compile time; I am not sure
about other compilers, but this is not performance-critical anyway.

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

compat: add mempcpy()Jonathan Nieder Sun, 21 Mar 2010 00:43:32 +0000 (19:43 -0500)

compat: add mempcpy()

The mempcpy() function was added in glibc 2.1. It is quite handy, so
add an implementation for cross-platform use.

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

checkout -m --conflict=diff3: add a label for ancestorJonathan Nieder Sun, 21 Mar 2010 00:42:51 +0000 (19:42 -0500)

checkout -m --conflict=diff3: add a label for ancestor

git checkout --merge --conflict=diff3 can be used to present conflict
hunks including text from the common ancestor. The added information
is helpful for resolving a merge by hand, and merge tools tend to
understand it because it is very similar to what ‘diff3 -m’ produces.

Unlike current git, diff3 -m includes a label for the merge base on
the ||||||| line, and unfortunately, some tools cannot parse the
conflict hunks without it. Humans can benefit from a cue when
learning to interpreting the format, too. Mark the start of the text
from the old branch with a label based on the branch’s name.

git rerere does not have trouble parsing this output and its preimage
ids are unchanged since it includes its own code for recreating
conflict hunks. No other code in git tries to parse conflict hunks.

Requested-by: Stefan Monnier <monnier@iro.umontreal.ca>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

merge_trees(): add ancestor label parameter for diff3... Jonathan Nieder Sun, 21 Mar 2010 00:41:38 +0000 (19:41 -0500)

merge_trees(): add ancestor label parameter for diff3-style output

Commands using the merge_trees() machinery will present conflict hunks
in output something like what ‘diff3 -m’ produces if the
merge.conflictstyle configuration option is set to diff3. The output
lacks the name of the merge base on the ||||||| line of the output,
and tools can misparse the conflict hunks without it. Add a new
o->ancestor parameter to merge_trees() for use as a label for the
ancestor in conflict hunks.

If o->ancestor is NULL, the output format is as before. All callers
pass NULL for now.

If o->ancestor is non-NULL and both branches renamed the base file
to the same name, that name is included in the conflict hunk labels.
Even if o->ancestor is NULL I think this would be a good change, but
this patch only does it in the non-NULL case to ensure the output
format does not change where it might matter.

Requested-by: Stefan Monnier <monnier@iro.umontreal.ca>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

merge_file(): add comment explaining behavior wrt confl... Jonathan Nieder Sun, 21 Mar 2010 00:40:53 +0000 (19:40 -0500)

merge_file(): add comment explaining behavior wrt conflict style

The merge_file() function is a helper for ‘git read-tree’, which does
not respect the merge.conflictstyle option, so there is no need to
worry about what ancestor_name it should pass to ll_merge(). Add a
comment to this effect.

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

checkout --conflict=diff3: add a label for ancestorJonathan Nieder Sun, 21 Mar 2010 00:40:19 +0000 (19:40 -0500)

checkout --conflict=diff3: add a label for ancestor

git checkout --conflict=diff3 can be used to present conflicts hunks
including text from the common ancestor:

<<<<<<< ours
ourside
|||||||
original
=======
theirside
>>>>>>> theirs

The added information is helpful for resolving a merge by hand, and
merge tools can usually understand it without trouble because it looks
like output from ‘diff3 -m’.

diff3 includes a label for the merge base on the ||||||| line, and it
seems some tools (for example, Emacs 22’s smerge-mode) cannot parse
conflict hunks without such a label. Humans could use help in
interpreting the output, too. So change the marker for the start of the
text from the common ancestor to include the label “base”.

git rerere’s conflict identifiers are not affected: to parse conflict
hunks, rerere looks for whitespace after the ||||||| marker rather
than a newline, and to compute preimage ids, rerere has its own code
for creating conflict hunks. No other code in git tries to parse
conflict hunks.

Requested-by: Stefan Monnier <monnier@iro.umontreal.ca>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

ll_merge(): add ancestor label parameter for diff3... Jonathan Nieder Sun, 21 Mar 2010 00:38:58 +0000 (19:38 -0500)

ll_merge(): add ancestor label parameter for diff3-style output

Commands using the ll_merge() function will present conflict hunks
imitating ‘diff3 -m’ output if the merge.conflictstyle configuration
option is set appropriately. Unlike ‘diff3 -m’, the output does not
include a label for the merge base on the ||||||| line of the output,
and some tools misparse the conflict hunks without that.

Add a new ancestor_label parameter to ll_merge() to give callers the
power to rectify this situation. If ancestor_label is NULL, the output
format is unchanged. All callers pass NULL for now.

Requested-by: Stefan Monnier <monnier@iro.umontreal.ca>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

merge-file --diff3: add a label for ancestorJonathan Nieder Sun, 21 Mar 2010 00:37:33 +0000 (19:37 -0500)

merge-file --diff3: add a label for ancestor

git merge-file --diff3 can be used to present conflicts hunks
including text from the common ancestor.

The added information is helpful for resolving a merge by hand, and
merge tools can usually grok it because it looks like output from
diff3 -m. However, ‘diff3’ includes a label for the merge base on the
||||||| line and some tools cannot parse conflict hunks without such a
label. Write the base-name as passed in a -L option (or the name of
the ancestor file by default) on that line.

git rerere will not have trouble parsing this output, since instead of
looking for a newline, it looks for whitespace after the |||||||
marker. Since rerere includes its own code for recreating conflict
hunks, conflict identifiers are unaffected. No other code in git tries
to parse conflict hunks.

Requested-by: Stefan Monnier <monnier@iro.umontreal.ca>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

xdl_merge(): move file1 and file2 labels to xmparam... Jonathan Nieder Sun, 21 Mar 2010 00:35:18 +0000 (19:35 -0500)

xdl_merge(): move file1 and file2 labels to xmparam structure

The labels for the three participants in a potential conflict are all
optional arguments for the xdiff merge routine; if they are NULL, then
xdl_merge() can cope by omitting the labels from its output. Move
them to the xmparam structure to allow new callers to save some
keystrokes where they are not needed.

This also has the virtue of making the xdiff merge interface more
similar to merge_trees, which might make it easier to learn.

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

xdl_merge(): add optional ancestor label to diff3-style... Jonathan Nieder Sun, 21 Mar 2010 00:31:44 +0000 (19:31 -0500)

xdl_merge(): add optional ancestor label to diff3-style output

The ‘git checkout --conflict=diff3’ command can be used to
present conflicts hunks including text from the common ancestor:

<<<<<<< ours
ourside
|||||||
original
=======
theirside
>>>>>>> theirs

The added information is helpful for resolving merges by hand, and
merge tools can usually grok it because it is very similar to the
output from diff3 -m.

A subtle change can help more tools to understand the output. ‘diff3’
includes the name of the merge base on the ||||||| line of the output,
and some tools misparse the conflict hunks without it. Add a new
xmp->ancestor parameter to xdl_merge() for use with conflict style
XDL_MERGE_DIFF3 as a label on the ||||||| line for any conflict hunks.

If xmp->ancestor is NULL, the output format is unchanged. Thus, this
change only provides unexposed plumbing for the new feature; it does
not affect the outward behavior of git.

Requested-by: Stefan Monnier <monnier@iro.umontreal.ca>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Acked-by: Bert Wesarg <Bert.Wesarg@googlemail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

tests: document cherry-pick behavior in face of conflictsJonathan Nieder Sun, 21 Mar 2010 00:28:14 +0000 (19:28 -0500)

tests: document cherry-pick behavior in face of conflicts

We are about to change the format of the conflict hunks that
cherry-pick and revert write. Add tests checking the current behavior
first.

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

tests: document format of conflicts from checkout -mJonathan Nieder Sun, 21 Mar 2010 00:27:17 +0000 (19:27 -0500)

tests: document format of conflicts from checkout -m

We are about to change the format of the conflict hunks that ‘checkout
--merge’ writes. Add tests checking the current behavior first.

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

.mailmap: Entries for Alex Bennée, Deskin Miller, Vital... Michael J Gruber Fri, 19 Mar 2010 11:02:04 +0000 (12:02 +0100)

.mailmap: Entries for Alex Bennée, Deskin Miller, Vitaly "_Vi" Shukela

With the current .mailmap, git shortlog shows the following for these:

11 Deskin Miller
3 Vitaly \"_Vi\" Shukela
1 Alex Bennee
1 Alex Bennée
1 Deskin Miler
1 Vitaly _Vi Shukela

Add (e-mail based qualified) entries to .mailmap to get:

12 Deskin Miller
4 Vitaly "_Vi" Shukela
2 Alex Bennée

The Shukela spelling is based on the version used consistently in the s-o-b
lines of all his patches.

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

revert: fix tiny memory leak in cherry-pick --ffJonathan Nieder Sun, 21 Mar 2010 02:01:20 +0000 (21:01 -0500)

revert: fix tiny memory leak in cherry-pick --ff

We forgot to free defmsg when returning early for a fast-forward.

Fixing this should reduce noise during test suite runs with valgrind.
More importantly, once cherry-pick learns to pick multiple commits,
the amount of memory leaked would start to add up.

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

Update draft release notes to 1.7.1Junio C Hamano Sat, 20 Mar 2010 18:42:34 +0000 (11:42 -0700)

Update draft release notes to 1.7.1

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

Merge branch 'jk/maint-add-ignored-dir'Junio C Hamano Sat, 20 Mar 2010 18:29:36 +0000 (11:29 -0700)

Merge branch 'jk/maint-add-ignored-dir'

* jk/maint-add-ignored-dir:
tests for "git add ignored-dir/file" without -f
dir: fix COLLECT_IGNORED on excluded prefixes
t0050: mark non-working test as such

Merge branch 'ml/color-grep'Junio C Hamano Sat, 20 Mar 2010 18:29:36 +0000 (11:29 -0700)

Merge branch 'ml/color-grep'

* ml/color-grep:
grep: Colorize selected, context, and function lines
grep: Colorize filename, line number, and separator
Add GIT_COLOR_BOLD_* and GIT_COLOR_BG_*

Merge branch 'jc/color-attrs'Junio C Hamano Sat, 20 Mar 2010 18:29:36 +0000 (11:29 -0700)

Merge branch 'jc/color-attrs'

* jc/color-attrs:
color: allow multiple attributes

Merge branch 'cc/reset-keep'Junio C Hamano Sat, 20 Mar 2010 18:29:35 +0000 (11:29 -0700)

Merge branch 'cc/reset-keep'

* cc/reset-keep:
Documentation: improve description of "git reset --keep"
reset: disallow using --keep when there are unmerged entries
reset: disallow "reset --keep" outside a work tree
Documentation: reset: describe new "--keep" option
reset: add test cases for "--keep" option
reset: add option "--keep" to "git reset"

Merge branch 'fl/askpass'Junio C Hamano Sat, 20 Mar 2010 18:29:35 +0000 (11:29 -0700)

Merge branch 'fl/askpass'

* fl/askpass:
git-core: Support retrieving passwords with GIT_ASKPASS
git-svn: Support retrieving passwords with GIT_ASKPASS

Merge branch 'bg/apply-fix-blank-at-eof'Junio C Hamano Sat, 20 Mar 2010 18:29:35 +0000 (11:29 -0700)

Merge branch 'bg/apply-fix-blank-at-eof'

* bg/apply-fix-blank-at-eof:
t3417: Add test cases for "rebase --whitespace=fix"
t4124: Add additional tests of --whitespace=fix
apply: Allow blank context lines to match beyond EOF
apply: Remove the quick rejection test
apply: Don't unnecessarily update line lengths in the preimage

Merge branch 'bw/union-merge-refactor'Junio C Hamano Sat, 20 Mar 2010 18:29:34 +0000 (11:29 -0700)

Merge branch 'bw/union-merge-refactor'

* bw/union-merge-refactor:
merge-file: add option to select union merge favor
merge-file: add option to specify the marker size
refactor merge flags into xmparam_t
make union merge an xdl merge favor

Merge branch 'maint'Junio C Hamano Sat, 20 Mar 2010 18:29:19 +0000 (11:29 -0700)

Merge branch 'maint'

* maint:
Update draft release notes to 1.7.0.3
fetch: Fix minor memory leak
fetch: Future-proof initialization of a refspec on stack
fetch: Check for a "^{}" suffix with suffixcmp()
daemon: parse_host_and_port SIGSEGV if port is specified
Makefile: Fix CDPATH problem
pull: replace unnecessary sed invocation

Update draft release notes to 1.7.0.3Junio C Hamano Sat, 20 Mar 2010 18:29:13 +0000 (11:29 -0700)

Update draft release notes to 1.7.0.3

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

rebase -i: use new --ff cherry-pick optionChristian Couder Sat, 6 Mar 2010 20:34:46 +0000 (21:34 +0100)

rebase -i: use new --ff cherry-pick option

This simplifies rebase -i a little bit.

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

fetch: Fix minor memory leakAndreas Gruenbacher Mon, 15 Mar 2010 22:18:48 +0000 (23:18 +0100)

fetch: Fix minor memory leak

A temporary struct ref is allocated in store_updated_refs() but not
freed.

Signed-off-by: Andreas Gruenbacher <agruen@suse.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

fetch: Future-proof initialization of a refspec on... Andreas Gruenbacher Fri, 12 Mar 2010 22:27:33 +0000 (23:27 +0100)

fetch: Future-proof initialization of a refspec on stack

The open-coded version to initialize each and every member will break
when a new member is added to the structure.

Signed-off-by: Andreas Gruenbacher <agruen@suse.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

fetch: Check for a "^{}" suffix with suffixcmp()Andreas Gruenbacher Sat, 13 Mar 2010 17:17:04 +0000 (18:17 +0100)

fetch: Check for a "^{}" suffix with suffixcmp()

Otherwise, we will check random bytes for ref names < 3 characters.

Signed-off-by: Andreas Gruenbacher <agruen@suse.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Fix a spelling mistake in a git-p4 console messageBenjamin C Meyer Fri, 19 Mar 2010 04:39:10 +0000 (00:39 -0400)

Fix a spelling mistake in a git-p4 console message

Signed-off-by: Benjamin C Meyer <bmeyer@rim.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Use test_expect_success for test setupsBrian Gernhardt Sat, 20 Mar 2010 08:29:11 +0000 (04:29 -0400)

Use test_expect_success for test setups

Several tests did not use test_expect_success for their setup
commands. Putting these start commands into the testing framework
means both that errors during setup will be caught quickly and that
non-error text will be suppressed without -v.

Signed-off-by: Brian Gernhardt <brian@gernhardtsoftware.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Modernize git calling conventions in hook templatesBen Walton Sat, 20 Mar 2010 14:48:09 +0000 (10:48 -0400)

Modernize git calling conventions in hook templates

The hook templates were still using/referencing 'git-foo' instead of
'git foo.' This patch updates the sample hooks to use the modern
conventions instead.

Signed-off-by: Ben Walton <bwalton@artsci.utoronto.ca>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Make templates honour SHELL_PATH and PERL_PATHBen Walton Sat, 20 Mar 2010 14:48:08 +0000 (10:48 -0400)

Make templates honour SHELL_PATH and PERL_PATH

The hook script templates were hard coded to use /bin/sh and perl.
This patch ensures that they use the same tools specified for the rest
of the suite.

The impetus for the change was noticing that, as shipped, some of the
hooks used shell constructs that wouldn't work under Solaris' /bin/sh
(eg: $(cmd...) substitutions).

Signed-off-by: Ben Walton <bwalton@artsci.utoronto.ca>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

daemon: parse_host_and_port SIGSEGV if port is specifiedImre Deak Sat, 20 Mar 2010 02:23:58 +0000 (04:23 +0200)

daemon: parse_host_and_port SIGSEGV if port is specified

This typo will lead to git-daemon dying any time the connect
string includes a port after the host= attribute. This can lead
for example to one of the following error messages on the client
side when someone tries git clone git://...:<port>.

When the daemon is running on localhost:
fatal: The remote end hung up unexpectedly

or when the daemon is connected through an ssh tunnel:
fatal: protocol error: bad line length character: erro

In the latter case 'erro' comes from the daemon's reply:
error: git-daemon died of signal 11

Signed-off-by: Imre Deak <imre.deak@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Makefile: Fix occasional GIT-CFLAGS breakageJonathan Nieder Sat, 20 Mar 2010 03:20:12 +0000 (22:20 -0500)

Makefile: Fix occasional GIT-CFLAGS breakage

GNU make’s target-specific variables facility has one weird facet: any
variables set for a given target apply to all of its dependencies,
too. For example, when running “make exec_cmd.o”, since exec_cmd.o
depends on GIT-CFLAGS, the variable assignment in

exec_cmd.s exec_cmd.o: ALL_CFLAGS += \
'-DGIT_EXEC_PATH="$(gitexecdir_SQ)"' \
'-DBINDIR="$(bindir_relative_SQ)"' \
'-DPREFIX="$(prefix_SQ)"'

applies when refreshing GIT-CFLAGS, and the extra options get included
in the tracked compiler flags. If an object file like this is the
first target built, GIT-CFLAGS will appear to be out of date,
resulting in useless rebuilds and the dreaded “new build flags or
prefix” message.

This does not happen with every build because GIT-CFLAGS is only
refreshed once in a given “make” run, and usually the first target
does not set any variables. When this problem does rear its head, it
is very annoying.

So put target-specific flags in a separate EXTRA_CPPFLAGS variable
that is not included in $(TRACK_CFLAGS).

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

Makefile: Fix CDPATH problemJonathan Nieder Sat, 20 Mar 2010 00:06:15 +0000 (19:06 -0500)

Makefile: Fix CDPATH problem

If CDPATH is set, "cd" prints its destination to stdout, causing
the common (cd a && tar cf - .) | (cd b && tar xf -) idiom to fail.
For example:

make -C templates DESTDIR='' install
make[1]: Entering directory `/users/e477610/exptool/src/git-1.7.0.2/templates'
install -d -m 755 '/home/e477610/exptool/share/git-core/templates'
(cd blt && gtar cf - .) | \
(cd '/home/e477610/exptool/share/git-core/templates' && umask 022 && gtar xof -)
gtar: This does not look like a tar archive

Most git scripts already protect against use of CDPATH through
git-sh-setup, but the Makefile doesn’t.

Reported-by: Michael Cox <mhcox@bluezoosoftware.com>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

t/t5505-remote.sh: escape * to prevent interpretation... Brandon Casey Sat, 20 Mar 2010 00:10:20 +0000 (19:10 -0500)

t/t5505-remote.sh: escape * to prevent interpretation by shell as glob

This test is supposed to check that git-remote correctly refuses to delete
all URLS for the specified remote which match the '.*' regular expression.
Since the '*' was not protected, it was interpreted by the shell as a file
glob and expanded before being passed to git-remote. The call to
git-remote still exited non-zero in this case, and the overall test still
passed, but it exited non-zero because git-remote was passed the incorrect
number of arguments, not for the reason it was supposed to fail.

Correct the test by escaping the '*'.

Signed-off-by: Brandon Casey <casey@nrlssc.navy.mil>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

t5505: add missing &&Brandon Casey Fri, 19 Mar 2010 23:36:35 +0000 (18:36 -0500)

t5505: add missing &&

Signed-off-by: Brandon Casey <casey@nrlssc.navy.mil>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

t5505: remove unnecessary subshell invocationsBrandon Casey Fri, 19 Mar 2010 23:36:34 +0000 (18:36 -0500)

t5505: remove unnecessary subshell invocations

Signed-off-by: Brandon Casey <casey@nrlssc.navy.mil>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

notes.c: remove inappropriate call to returnBrandon Casey Thu, 18 Mar 2010 15:03:43 +0000 (10:03 -0500)

notes.c: remove inappropriate call to return

Signed-off-by: Brandon Casey <casey@nrlssc.navy.mil>
Acked-by: Johan Herland <johan@herland.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

pull: replace unnecessary sed invocationStephen Boyd Thu, 18 Mar 2010 05:10:45 +0000 (22:10 -0700)

pull: replace unnecessary sed invocation

Getting the shortened branch name is as easy as using the shell's
parameter expansion.

Signed-off-by: Stephen Boyd <bebarino@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Merge branch 'maint'Junio C Hamano Wed, 17 Mar 2010 21:24:08 +0000 (14:24 -0700)

Merge branch 'maint'

* maint:
Documentation: receive.denyCurrentBranch defaults to 'refuse'
bash: complete *_HEAD refs if present

Documentation: receive.denyCurrentBranch defaults to... Thomas Rast Wed, 17 Mar 2010 11:14:57 +0000 (12:14 +0100)

Documentation: receive.denyCurrentBranch defaults to 'refuse'

acd2a45 (Refuse updating the current branch in a non-bare repository
via push, 2009-02-11) changed the default to refuse such a push, but
it forgot to update the docs.

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

bash: complete *_HEAD refs if presentIan Ward Comfort Wed, 17 Mar 2010 09:20:35 +0000 (02:20 -0700)

bash: complete *_HEAD refs if present

We already complete HEAD, of course, and might as well complete the other
common refs mentioned in the rev-parse man page: FETCH_HEAD, ORIG_HEAD, and
MERGE_HEAD.

Signed-off-by: Ian Ward Comfort <icomfort@stanford.edu>
Acked-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Merge branch 'maint'Junio C Hamano Wed, 17 Mar 2010 02:30:37 +0000 (19:30 -0700)

Merge branch 'maint'

* maint:
Documentation/git-read-tree: clarify 2-tree merge
Documentation/git-read-tree: fix table layout

everyday: fsck and gc are not everyday operationsAnders Kaseorg Wed, 21 Oct 2009 20:02:48 +0000 (16:02 -0400)

everyday: fsck and gc are not everyday operations

Back in 2005 when this document was written, it may have made sense to
introduce ‘git fsck’ (then ‘git fsck-objects’) as the very first example
command for new users of Git 0.99.9. Now that Git has been stable for
years and does not actually tend to eat your data, it makes significantly
less sense. In fact, it sends an entirely wrong message.

‘git gc’ is also unnecessary for the purposes of this document, especially
with gc.auto enabled by default.

The only other commands in the “Basic Repository” section were ‘git init’
and ‘git clone’. ‘clone’ is already listed in the “Participant” section,
so move ‘init’ to the “Standalone” section and get rid of “Basic
Repository” entirely.

Signed-off-by: Anders Kaseorg <andersk@mit.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Improve error messages from 'git stash show'Gustaf Hendeby Tue, 16 Mar 2010 17:52:37 +0000 (18:52 +0100)

Improve error messages from 'git stash show'

The previous error message "fatal: Needed a single revision" is not
very informative.

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

daemon.c: avoid accessing ss_family member of struct... Brandon Casey Mon, 15 Mar 2010 22:10:06 +0000 (17:10 -0500)

daemon.c: avoid accessing ss_family member of struct sockaddr_storage

When NO_SOCKADDR_STORAGE is set for a platform, either sockaddr_in or
sockaddr_in6 is used intead. Neither of which has an ss_family member.
They have an sin_family and sin6_family member respectively. Since the
addrcmp() function accesses the ss_family member of a sockaddr_storage
struct, compilation fails on platforms which define NO_SOCKADDR_STORAGE.

Since any sockaddr_* structure can be cast to a struct sockaddr and
have its sa_family member read, do so here to workaround this issue.

Thanks to Martin Storsjö for pointing out the fix, and Gary Vaughan
for drawing attention to the issue.

Signed-off-by: Brandon Casey <casey@nrlssc.navy.mil>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

t/t1304: make a second colon optional in the mask ACL... Brandon Casey Mon, 15 Mar 2010 17:14:37 +0000 (12:14 -0500)

t/t1304: make a second colon optional in the mask ACL check

Solaris only uses one colon in the listing of the ACL mask, Linux uses two,
so substitute egrep for grep and make the second colon optional.

The -q option for Solaris 7's /usr/xpg4/bin/egrep does not appear to be
implemented, so redirect output to /dev/null.

Signed-off-by: Brandon Casey <casey@nrlssc.navy.mil>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

t/t1304: set the ACL effective rights maskBrandon Casey Mon, 15 Mar 2010 18:35:03 +0000 (13:35 -0500)

t/t1304: set the ACL effective rights mask

Some implementations of setfacl do not recalculate the effective rights
mask when the ACL is modified. So, set the effective rights mask
explicitly to ensure that the ACL's that are set on the directories will
have effect.

Signed-off-by: Brandon Casey <casey@nrlssc.navy.mil>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

t/t1304: use 'test -r' to test readability rather than... Brandon Casey Mon, 15 Mar 2010 17:14:35 +0000 (12:14 -0500)

t/t1304: use 'test -r' to test readability rather than looking at mode bits

This test was using the group read permission bit as an indicator of the
default ACL mask. This behavior is valid on Linux but not on other
platforms like Solaris. So, rather than looking at mode bits, just test
readability for the user. This, along with the checks for the existence
of the ACL's that were set on the parent directories, should be enough.

Signed-off-by: Brandon Casey <casey@nrlssc.navy.mil>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

t/t1304: set the Default ACL base entriesBrandon Casey Mon, 15 Mar 2010 17:14:34 +0000 (12:14 -0500)

t/t1304: set the Default ACL base entries

According to the Linux setfacl man page, in order for an ACL to be valid,
the following rules must be satisfied:

* Whenever an ACL contains any Default ACL entries, the three Default
ACL base entries (default owner, default group, and default others)
must also exist.

* Whenever a Default ACL contains named user entries or named group
objects, it must also contain a default effective rights mask.

Some implementations of setfacl (Linux) do this automatically when
necessary, some (Solaris) do not. Solaris's setfacl croaks when trying to
create a default user ACL if the above rules are not satisfied. So, create
them before modifying the default user ACL's.

Signed-off-by: Brandon Casey <casey@nrlssc.navy.mil>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

t/t1304: avoid -d option to setfaclBrandon Casey Mon, 15 Mar 2010 17:14:33 +0000 (12:14 -0500)

t/t1304: avoid -d option to setfacl

Some platforms (Solaris) have a setfacl whose -d switch works differently
than the one on Linux. On Linux, it causes all operations to be applied
to the Default ACL. There is a notation for operating on the Default ACL:

[d[efault]:] [u[ser]:]uid [:perms]

so use it instead of the -d switch.

Signed-off-by: Brandon Casey <casey@nrlssc.navy.mil>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

refs: ref entry with NULL sha1 is can be a dangling... Junio C Hamano Tue, 16 Mar 2010 05:12:55 +0000 (22:12 -0700)

refs: ref entry with NULL sha1 is can be a dangling symref

Brandon Casey noticed that t5505 had accidentally broken its && chain,
hiding inconsistency between the code that writes the warning to the
standard output and the test that expects to see the warning on the
standard error, which was introduced by f8948e2 (remote prune: warn
dangling symrefs, 2009-02-08).

It turns out that the issue is deeper than that. After f8948e2, a symref
that is dangling is marked with a NULL sha1, and the idea of using NULL
sha1 to mean a deleted ref was scrapped, but somehow a follow-up eafb452
(do_one_ref(): null_sha1 check is not about broken ref, 2009-07-22)
incorrectly reorganized do_one_ref(), still thinking NULL sha1 is never
used in the code.

Fix this by:

- adopt Brandon's fix to t5505 test;

- introduce REF_BROKEN flag to mark a ref that fails to resolve (dangling
symref);

- move the check for broken ref back inside the "if we are skipping
dangling refs" code block.

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

grep: enable threading for context line printingRené Scharfe Mon, 15 Mar 2010 16:21:10 +0000 (17:21 +0100)

grep: enable threading for context line printing

If context lines are to be printed, grep separates them with hunk marks
("--\n"). These marks are printed between matches from different files,
too. They are not printed before the first file, though.

Threading was disabled when context line printing was enabled because
avoiding to print the mark before the first line was an unsolved
synchronisation problem. This patch separates the code for printing
hunk marks for the threaded and the unthreaded case, allowing threading
to be turned on together with the common -ABC options.

->show_hunk_mark, which controls printing of hunk marks between files in
show_line(), is now set in grep_buffer_1(), but only if some results
have already been printed and threading is disabled. The threaded case
is handled in work_done().

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

Documentation/git-read-tree: clarify 2-tree mergeMichael J Gruber Mon, 15 Mar 2010 10:54:46 +0000 (11:54 +0100)

Documentation/git-read-tree: clarify 2-tree merge

Clarify the description of the 2-tree merge by defining the terms
which are used in the table, and by applying some small linguistic
changes.

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

Documentation/git-read-tree: fix table layoutMichael J Gruber Mon, 15 Mar 2010 10:54:45 +0000 (11:54 +0100)

Documentation/git-read-tree: fix table layout

Asciidoc takes the first non-space character in the first line of the
paragraph as a reference point for preformatted layout, so adjust to
that to make the table align.

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

Merge branch 'sd/format-patch-to'Junio C Hamano Mon, 15 Mar 2010 07:58:55 +0000 (00:58 -0700)

Merge branch 'sd/format-patch-to'

* sd/format-patch-to:
send-email: add --no-cc, --no-to, and --no-bcc
format-patch: add --no-cc, --no-to, and --no-add-headers
format-patch: use a string_list for headers
Add 'git format-patch --to=' option and 'format.to' configuration variable.

Merge branch 'tc/http-cleanup'Junio C Hamano Mon, 15 Mar 2010 07:58:50 +0000 (00:58 -0700)

Merge branch 'tc/http-cleanup'

* tc/http-cleanup:
remote-curl: init walker only when needed
remote-curl: use http_fetch_ref() instead of walker wrapper
http: init and cleanup separately from http-walker
http-walker: cleanup more thoroughly
http-push: remove "|| 1" to enable verbose check
t554[01]-http-push: refactor, add non-ff tests
t5541-http-push: check that ref is unchanged for non-ff test

Merge branch 'tc/transport-verbosity'Junio C Hamano Mon, 15 Mar 2010 07:58:42 +0000 (00:58 -0700)

Merge branch 'tc/transport-verbosity'

* tc/transport-verbosity:
transport: update flags to be in running order
fetch and pull: learn --progress
push: learn --progress
transport->progress: use flag authoritatively
clone: support multiple levels of verbosity
push: support multiple levels of verbosity
fetch: refactor verbosity option handling into transport.[ch]
Documentation/git-push: put --quiet before --verbose
Documentation/git-pull: put verbosity options before merge/fetch ones
Documentation/git-clone: mention progress in -v

Conflicts:
transport.h

Merge branch 'ld/push-porcelain'Junio C Hamano Mon, 15 Mar 2010 07:58:24 +0000 (00:58 -0700)

Merge branch 'ld/push-porcelain'

* ld/push-porcelain:
t5516: Use test_cmp when appropriate
git-push: add tests for git push --porcelain
git-push: make git push --porcelain print "Done"
git-push: send "To <remoteurl>" messages to the standard output in --porcelain mode
git-push: fix an advice message so it goes to stderr

Conflicts:
transport.c

Merge branch 'jh/notes'Junio C Hamano Mon, 15 Mar 2010 07:52:06 +0000 (00:52 -0700)

Merge branch 'jh/notes'

* jh/notes: (33 commits)
Documentation: fix a few typos in git-notes.txt
notes: fix malformed tree entry
builtin-notes: Minor (mostly parse_options-related) fixes
builtin-notes: Add "copy" subcommand for copying notes between objects
builtin-notes: Misc. refactoring of argc and exit value handling
builtin-notes: Add -c/-C options for reusing notes
builtin-notes: Refactor handling of -F option to allow combining -m and -F
builtin-notes: Deprecate the -m/-F options for "git notes edit"
builtin-notes: Add "append" subcommand for appending to note objects
builtin-notes: Add "add" subcommand for adding notes to objects
builtin-notes: Add --message/--file aliases for -m/-F options
builtin-notes: Add "list" subcommand for listing note objects
Documentation: Generalize git-notes docs to 'objects' instead of 'commits'
builtin-notes: Add "prune" subcommand for removing notes for missing objects
Notes API: prune_notes(): Prune notes that belong to non-existing objects
t3305: Verify that removing notes triggers automatic fanout consolidation
builtin-notes: Add "remove" subcommand for removing existing notes
Teach builtin-notes to remove empty notes
Teach notes code to properly preserve non-notes in the notes tree
t3305: Verify that adding many notes with git-notes triggers increased fanout
...

Conflicts:
Makefile

rebase--interactive: don't require what's rebased to... Dave Olszewski Mon, 15 Mar 2010 04:48:22 +0000 (21:48 -0700)

rebase--interactive: don't require what's rebased to be a branch

git rebase allows you to specify a non-branch commit-ish as the "branch"
argument, which leaves HEAD detached when it's finished. This is
occasionally useful, and this patch brings the same functionality to git
rebase --interactive.

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

git-send-email.perl - try to give real name of the... Jari Aalto Sun, 14 Mar 2010 15:16:45 +0000 (17:16 +0200)

git-send-email.perl - try to give real name of the calling host to HELO/EHLO

Add new functions maildomain_net(), maildomain_mta() and
maildomain(), which return FQDN where possible for use in
send_message(). The value is passed to Net::SMTP HELO/EHLO
handshake. The domain name can also be set via new --smtp-domain
option.

The default value in Net::SMTP may not get through:

Net::SMTP=GLOB(0x267ec28)>>> EHLO localhost.localdomain
Net::SMTP=GLOB(0x267ec28)<<< 550 EHLO argument does not match calling host

whereas using the FQDN that matches the IP, the result is:

Net::SMTP=GLOB(0x15b8e80)>>> EHLO host.example.com
Net::SMTP=GLOB(0x15b8e80)<<< 250-host.example.com Hello host.example.com [192.168.1.7]

The maildomain*() code is based on ideas in Perl library
Test::Reporter by Graham Barr <gbarr@pobox.com> and Mark Overmeer
<mailtools@overmeer.net> released under the same terms as Perl
itself.

Signed-off-by: Jari Aalto <jari.aalto@cante.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

git-send-email.perl: add option --smtp-debugJari Aalto Sun, 14 Mar 2010 15:16:09 +0000 (17:16 +0200)

git-send-email.perl: add option --smtp-debug

Signed-off-by: Jari Aalto <jari.aalto@cante.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

git-send-email.perl: improve error message in send_mess... Jari Aalto Sun, 14 Mar 2010 15:15:33 +0000 (17:15 +0200)

git-send-email.perl: improve error message in send_message()

Signed-off-by: Jari Aalto <jari.aalto@cante.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

tests for "git add ignored-dir/file" without -fJunio C Hamano Mon, 1 Mar 2010 03:12:31 +0000 (19:12 -0800)

tests for "git add ignored-dir/file" without -f

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

dir: fix COLLECT_IGNORED on excluded prefixesJeff King Thu, 11 Mar 2010 07:15:43 +0000 (02:15 -0500)

dir: fix COLLECT_IGNORED on excluded prefixes

As we walk the directory tree, if we see an ignored path, we
want to add it to the ignored list only if it matches any
pathspec that we were given. We used to check for the
pathspec to appear explicitly. E.g., if we see "subdir/file"
and it is excluded, we check to see if we have "subdir/file"
in our pathspec.

However, this interacts badly with the optimization to avoid
recursing into ignored subdirectories. If "subdir" as a
whole is ignored, then we never recurse, and consider only
whether "subdir" itself is in our pathspec. It would not
match a pathspec of "subdir/file" explicitly, even though it
is the reason that subdir/file would be excluded.

This manifests itself to the user as "git add subdir/file"
failing to correctly note that the pathspec was ignored.

This patch extends the in_pathspec logic to include prefix
directory case.

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

t0050: mark non-working test as suchJunio C Hamano Mon, 1 Mar 2010 07:31:21 +0000 (23:31 -0800)

t0050: mark non-working test as such

The test is to prepare an empty file "camelcase" in the index, remove
and replace it with another file "CamelCase" with "1" as its contents
in the working tree, and add it to the index, in a repository configured
to be case insensitive.

However, the test actually checked ls-files knows about a pathname that
matches "camelcase" case insensitively. It didn't check if the added
contents actually was the updated one.

Mark the test as non-working.

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

git status: ignoring untracked files must apply to... Jens Lehmann Sat, 13 Mar 2010 22:00:27 +0000 (23:00 +0100)

git status: ignoring untracked files must apply to submodules too

Since 1.7.0 submodules are considered dirty when they contain untracked
files. But when git status is called with the "-uno" option, the user
asked to ignore untracked files, so they must be ignored in submodules
too. To achieve this, the new flag DIFF_OPT_IGNORE_UNTRACKED_IN_SUBMODULES
is introduced.

Signed-off-by: Jens Lehmann <Jens.Lehmann@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Merge branch 'maint'Junio C Hamano Sun, 14 Mar 2010 05:31:42 +0000 (21:31 -0800)

Merge branch 'maint'

* maint:
don't use default revision if a rev was specified
for_each_recent_reflog_ent(): use strbuf, fix offset handling
t/Makefile: remove test artifacts upon "make clean"
blame: fix indent of line numbers

don't use default revision if a rev was specifiedDave Olszewski Sat, 13 Mar 2010 22:47:05 +0000 (14:47 -0800)

don't use default revision if a rev was specified

If a revision is specified, it happens not to have any commits, don't
use the default revision. By doing so, surprising and undesired
behavior can happen, such as showing the reflog for HEAD when a branch
was specified.

[jc: squashed a test from René]

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

for_each_recent_reflog_ent(): use strbuf, fix offset... René Scharfe Sat, 13 Mar 2010 17:37:50 +0000 (18:37 +0100)

for_each_recent_reflog_ent(): use strbuf, fix offset handling

As Vladimir reported, "git log -g refs/stash" surprisingly showed the reflog
of HEAD if the message in the reflog file was too long. To fix this, convert
for_each_recent_reflog_ent() to use strbuf_getwholeline() instead of fgets(),
for safety and to avoid any size limits for reflog entries.

Also reverse the logic of the part of the function that only looks at file
tails. It used to close the file if fgets() succeeded. The following
fgets() call in the while loop was likely to fail in this case, too, so
passing an offset to for_each_recent_reflog_ent() never worked. Change it to
error out if strbuf_getwholeline() fails instead.

Reported-by: Vladimir Panteleev <vladimir@thecybershadow.net>
Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

t/Makefile: remove test artifacts upon "make clean"Junio C Hamano Sat, 13 Mar 2010 20:41:20 +0000 (12:41 -0800)

t/Makefile: remove test artifacts upon "make clean"

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

blame: fix indent of line numbersRené Scharfe Sat, 13 Mar 2010 10:25:12 +0000 (11:25 +0100)

blame: fix indent of line numbers

Correct the calculation of the number of digits for line counts of the
form 10^n-1 (9, 99, ...) in lineno_width(). This makes blame stop
printing an extra space before the line numbers of files with that many
total lines.

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

Merge git://git.bogomips.org/git-svnJunio C Hamano Sat, 13 Mar 2010 20:02:54 +0000 (12:02 -0800)

Merge git://git.bogomips.org/git-svn

* git://git.bogomips.org/git-svn:
t9150,t9151: Add rewrite-root option to init
git-svn: Fix merge detecting with rewrite-root

t9150,t9151: Add rewrite-root option to initTuomas Suutari Wed, 24 Feb 2010 18:09:02 +0000 (20:09 +0200)

t9150,t9151: Add rewrite-root option to init

The rewrite-root option seems to be a bit problematic with merge
detecting, so it's better to have a merge detecting test with it
turned on.

Signed-off-by: Tuomas Suutari <tuomas.suutari@gmail.com>
Acked-by: Eric Wong <normalperson@yhbt.net>

git-svn: Fix merge detecting with rewrite-rootTuomas Suutari Wed, 24 Feb 2010 18:09:01 +0000 (20:09 +0200)

git-svn: Fix merge detecting with rewrite-root

Detecting of merges from svn:mergeinfo or svk merge tickets failed
with rewrite-root option. This fixes it.

Signed-off-by: Tuomas Suutari <tuomas.suutari@gmail.com>
Acked-by: Eric Wong <normalperson@yhbt.net>

git status: Fix false positive "new commits" output... Jens Lehmann Fri, 12 Mar 2010 21:23:52 +0000 (22:23 +0100)

git status: Fix false positive "new commits" output for dirty submodules

Testing if the output "new commits" should appear in the long format of
"git status" is done by comparing the hashes of the diffpair. This always
resulted in printing "new commits" for submodules that contained untracked
or modified content, even if they did not contain new commits. The reason
was that match_stat_with_submodule() did set the "changed" flag for dirty
submodules, resulting in two->sha1 being set to the null_sha1 at the call
sites, which indicates that new commits are present. This is changed so
that when no new commits are present, the same object names are in the
sha1 field for both sides of the filepair, and the working tree side will
have the "dirty_submodule" flag set when appropriate. For a submodule to
be seen as modified even when it just has a dirty work tree, some
conditions had to be extended to also check for the "dirty_submodule"
flag.

Unfortunately the test case that should have found this bug had been
changed incorrectly too. It is fixed and extended to test for other
combinations too.

Signed-off-by: Jens Lehmann <Jens.Lehmann@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Refactor dirty submodule detection in diff-lib.cJens Lehmann Thu, 11 Mar 2010 21:50:25 +0000 (22:50 +0100)

Refactor dirty submodule detection in diff-lib.c

Moving duplicated code into the new function match_stat_with_submodule().
Replacing the implicit activation of detailed checks for the dirtiness of
submodules when DIFF_FORMAT_PATCH was selected with explicitly setting
the recently added DIFF_OPT_DIRTY_SUBMODULES option in diff_setup_done().

Signed-off-by: Jens Lehmann <Jens.Lehmann@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Merge branch 'maint'Junio C Hamano Sat, 13 Mar 2010 06:13:22 +0000 (22:13 -0800)

Merge branch 'maint'

* maint:
t9400: Use test_cmp when appropriate

notes: rework subcommands and parse optionsStephen Boyd Sat, 27 Feb 2010 08:59:22 +0000 (00:59 -0800)

notes: rework subcommands and parse options

Running 'git notes copy -h' is not very helfpul right now. It lists
the options for all the git notes subcommands and is rather confusing.
Fix this by splitting cmd_notes() into separate functions for each
subcommand (besides append and edit since they're very similar) and
only providing a usage message for the subcommand.

This has an added benefit of reducing the code complexity while making
it safer and easier to read. The downside is we get some code bloat
from similar setup and teardown needed for notes and options parsing.
We also get a bit stricter in options parsing by only allowing
the ref option to come before the subcommand.

Acked-by: Johan Herland <johan@herland.net>
Cc: Thomas Rast <trast@student.ethz.ch>
Signed-off-by: Stephen Boyd <bebarino@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

git-notes(1): add a section about the meaning of historyThomas Rast Fri, 12 Mar 2010 17:04:37 +0000 (18:04 +0100)

git-notes(1): add a section about the meaning of history

To the displaying code, the only interesting thing about a notes ref
is that it has a tree of the required format. However, notes actually
have a history since they are recorded as successive commits.

Make a note about the existence of this history in the manpage, but
keep some doors open if we want to change the details.

Signed-off-by: Thomas Rast <trast@student.ethz.ch>
Acked-by: Johan Herland <johan@herland.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

notes: track whether notes_trees were changed at allThomas Rast Fri, 12 Mar 2010 17:04:36 +0000 (18:04 +0100)

notes: track whether notes_trees were changed at all

Currently, the notes copying is a bit wasteful since it always creates
new trees, even if no notes were copied at all.

Teach add_note() and remove_note() to flag the affected notes tree as
changed ('dirty'). Then teach builtin/notes.c to use this knowledge
and avoid committing trees that weren't changed.

Signed-off-by: Thomas Rast <trast@student.ethz.ch>
Acked-by: Johan Herland <johan@herland.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

notes: add shorthand --ref to override GIT_NOTES_REFThomas Rast Fri, 12 Mar 2010 17:04:35 +0000 (18:04 +0100)

notes: add shorthand --ref to override GIT_NOTES_REF

Adds a shorthand option that overrides the GIT_NOTES_REF variable, and
hence determines the notes tree that will be manipulated. It also
DWIMs a refs/notes/ prefix.

Signed-off-by: Thomas Rast <trast@student.ethz.ch>
Acked-by: Johan Herland <johan@herland.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

commit --amend: copy notes to the new commitThomas Rast Fri, 12 Mar 2010 17:04:34 +0000 (18:04 +0100)

commit --amend: copy notes to the new commit

Teaches 'git commit --amend' to copy notes. The catch is that this
must also be guarded by --no-post-rewrite, which we use to prevent
--amend from copying notes during a rebase -i 'edit'/'reword'.

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

rebase: support automatic notes copyingThomas Rast Fri, 12 Mar 2010 17:04:33 +0000 (18:04 +0100)

rebase: support automatic notes copying

Luckily, all the support already happens to be there.

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

notes: implement helpers needed for note copying during... Thomas Rast Fri, 12 Mar 2010 17:04:32 +0000 (18:04 +0100)

notes: implement helpers needed for note copying during rewrite

Implement helper functions to load the rewriting config, and to
actually copy the notes. Also document the config.

Secondly, also implement an undocumented --for-rewrite=<cmd> option to
'git notes copy' which is used like --stdin, but also puts the
configuration for <cmd> into effect. It will be needed to support the
copying in git-rebase.

Signed-off-by: Thomas Rast <trast@student.ethz.ch>
Acked-by: Johan Herland <johan@herland.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

notes: implement 'git notes copy --stdin'Thomas Rast Fri, 12 Mar 2010 17:04:31 +0000 (18:04 +0100)

notes: implement 'git notes copy --stdin'

This implements a mass-copy command that takes a sequence of lines in
the format

<from-sha1> SP <to-sha1> [ SP <rest> ] LF

on stdin, and copies each <from-sha1>'s notes to the <to-sha1>. The
<rest> is ignored. The intent, of course, is that this can read the
same input that the 'post-rewrite' hook gets.

The copy_note() function is exposed for everyone's and in particular
the next commit's use.

Signed-off-by: Thomas Rast <trast@student.ethz.ch>
Acked-by: Johan Herland <johan@herland.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

rebase -i: invoke post-rewrite hookThomas Rast Fri, 12 Mar 2010 17:04:30 +0000 (18:04 +0100)

rebase -i: invoke post-rewrite hook

Aside from the same issue that rebase also has (remembering the
original commit across a conflict resolution), rebase -i brings an
extra twist: We need to defer writing the rewritten list in the case
of {squash,fixup} because their rewritten result should be the last
commit in the squashed group.

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

rebase: invoke post-rewrite hookThomas Rast Fri, 12 Mar 2010 17:04:29 +0000 (18:04 +0100)

rebase: invoke post-rewrite hook

We have to deal with two separate code paths: a normal rebase, which
actually goes through git-am; and rebase {-m|-s}.

The only small issue with both is that they need to remember the
original sha1 across a possible conflict resolution. rebase -m
already puts this information in $dotest/current, and we just
introduce a similar file for git-am.

Note that in git-am, the hook really only runs when coming from
git-rebase: the code path that sets the $dotest/original-commit file
is guarded by a test for $dotest/rebasing.

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

commit --amend: invoke post-rewrite hookThomas Rast Fri, 12 Mar 2010 17:04:28 +0000 (18:04 +0100)

commit --amend: invoke post-rewrite hook

The rough structure of run_rewrite_hook() comes from
run_receive_hook() in receive-pack.

We introduce a --no-post-rewrite option and use it to avoid the hook
when called from git-rebase -i 'edit'. The next patch will add full
support in git-rebase, and we only want to invoke the hook once.

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

Documentation: document post-rewrite hookThomas Rast Fri, 12 Mar 2010 17:04:27 +0000 (18:04 +0100)

Documentation: document post-rewrite hook

This defines the behaviour of the post-rewrite hook support, which
will be implemented in the following patches.

We deliberately do not document how often the hook will be invoked per
rewriting command, but the interface is designed to keep that at
"once". This would currently not matter too much, since both rebase
and filter-branch are shellscripts and spawn many processes anyway.
However, when a fast sequencer in C is implemented, it will be
beneficial to only have to run the hook once.

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

Support showing notes from more than one notes treeThomas Rast Fri, 12 Mar 2010 17:04:26 +0000 (18:04 +0100)

Support showing notes from more than one notes tree

With this patch, you can set notes.displayRef to a glob that points at
your favourite notes refs, e.g.,

[notes]
displayRef = refs/notes/*

Then git-log and friends will show notes from all trees.

Thanks to Junio C Hamano for lots of feedback, which greatly
influenced the design of the entire series and this commit in
particular.

Signed-off-by: Thomas Rast <trast@student.ethz.ch>
Acked-by: Johan Herland <johan@herland.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

test-lib: unset GIT_NOTES_REF to stop it from influenci... Thomas Rast Fri, 12 Mar 2010 17:04:25 +0000 (18:04 +0100)

test-lib: unset GIT_NOTES_REF to stop it from influencing tests

Signed-off-by: Thomas Rast <trast@student.ethz.ch>
Acked-by: Johan Herland <johan@herland.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

t5516: Use test_cmp when appropriateJunio C Hamano Fri, 12 Mar 2010 05:51:57 +0000 (21:51 -0800)

t5516: Use test_cmp when appropriate

Consistently using test_cmp would make debugging test scripts far easier,
as output from them run under "-v" option becomes readable.

Besides, some platforms' "diff" implementations lack "-q" option.

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

t9400: Use test_cmp when appropriateJunio C Hamano Fri, 12 Mar 2010 05:40:33 +0000 (21:40 -0800)

t9400: Use test_cmp when appropriate

Consistently using test_cmp would make debugging test scripts far easier,
as output from them run under "-v" option becomes readable.

Besides, some platforms' "diff" implementations lack "-q" option.

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

Merge branch 'sd/init-template'Junio C Hamano Wed, 10 Mar 2010 23:32:43 +0000 (15:32 -0800)

Merge branch 'sd/init-template'

* sd/init-template:
wrap-for-bin: do not export an empty GIT_TEMPLATE_DIR
t/t0001-init.sh: add test for 'init with init.templatedir set'
init: having keywords without value is not a global error.
Add a "TEMPLATE DIRECTORY" section to git-init[1].
Add `init.templatedir` configuration variable.

Merge branch 'sh/am-keep-cr'Junio C Hamano Wed, 10 Mar 2010 23:32:34 +0000 (15:32 -0800)

Merge branch 'sh/am-keep-cr'

* sh/am-keep-cr:
git-am: Add tests for `--keep-cr`, `--no-keep-cr` and `am.keepcr`
git-am: Add am.keepcr and --no-keep-cr to override it
git-am: Add command line parameter `--keep-cr` passing it to git-mailsplit
documentation: 'git-mailsplit --keep-cr' is not hidden anymore

Merge branch 'cp/add-u-pathspec'Junio C Hamano Wed, 10 Mar 2010 23:32:02 +0000 (15:32 -0800)

Merge branch 'cp/add-u-pathspec'

* cp/add-u-pathspec:
test for add with non-existent pathspec
git add -u: die on unmatched pathspec

Makefile: update check-docs targetJunio C Hamano Wed, 10 Mar 2010 23:31:34 +0000 (15:31 -0800)

Makefile: update check-docs target

When we added bunch of git-remote-* helper backends, we should have
done this to squelch complaints that they do not have their own
manual pages. Also the entry for git-remote-helpers was not
properly marked as a non-command.

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