git/git.git
11 years agonotes: rework subcommands and parse options
Stephen 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>
11 years agogit-notes(1): add a section about the meaning of history
Thomas 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>
11 years agonotes: track whether notes_trees were changed at all
Thomas 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>
11 years agonotes: add shorthand --ref to override GIT_NOTES_REF
Thomas 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>
11 years agocommit --amend: copy notes to the new commit
Thomas 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>
11 years agorebase: support automatic notes copying
Thomas 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>
11 years agonotes: implement helpers needed for note copying during rewrite
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>
11 years agonotes: 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>
11 years agorebase -i: invoke post-rewrite hook
Thomas 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>
11 years agorebase: invoke post-rewrite hook
Thomas 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>
11 years agocommit --amend: invoke post-rewrite hook
Thomas 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>
11 years agoDocumentation: document post-rewrite hook
Thomas 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>
11 years agoSupport showing notes from more than one notes tree
Thomas 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>
11 years agotest-lib: unset GIT_NOTES_REF to stop it from influencing tests
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>
11 years agoMerge branch 'il/rev-glob'
Junio C Hamano [Tue, 23 Feb 2010 20:05:18 +0000 (12:05 -0800)]
Merge branch 'il/rev-glob'

11 years agobuiltin-notes: Add "copy" subcommand for copying notes between objects
Johan Herland [Sat, 13 Feb 2010 21:28:38 +0000 (22:28 +0100)]
builtin-notes: Add "copy" subcommand for copying notes between objects

This is useful for keeping notes to objects that are being rewritten by e.g.
'git commit --amend', 'git rebase', or 'git cherry-pick'.

"git notes copy <from> <to>" is in practice equivalent to
"git notes add -C $(git notes list <from>) <to>", although it is somewhat
more convenient for regular users.

"git notes copy" takes the same -f option as "git add", to overwrite existing
notes at the target (instead of aborting with an error message).

If the <from>-object has no notes, "git notes copy" will abort with an error
message.

The patch includes tests verifying correct behaviour of the new subcommand.

Signed-off-by: Johan Herland <johan@herland.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agobuiltin-notes: Misc. refactoring of argc and exit value handling
Johan Herland [Sat, 13 Feb 2010 21:28:37 +0000 (22:28 +0100)]
builtin-notes: Misc. refactoring of argc and exit value handling

This is in preparation of future patches that add additional subcommands.

Signed-off-by: Johan Herland <johan@herland.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agobuiltin-notes: Add -c/-C options for reusing notes
Johan Herland [Sat, 13 Feb 2010 21:28:36 +0000 (22:28 +0100)]
builtin-notes: Add -c/-C options for reusing notes

Inspired by the -c/-C options to "git commit", we teach these options to
"git notes add/append" to allow reuse of note objects.

With this patch in place, it is now easy to copy or move notes between
objects. For example, to copy object A's notes to object B:
git notes add [-f] -C $(git notes list A) B
To move instead of copying, you simply remove the notes from the source
object afterwards, e.g.:
git notes remove A

The patch includes tests verifying correct behaviour of the new functionality.

Signed-off-by: Johan Herland <johan@herland.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agobuiltin-notes: Refactor handling of -F option to allow combining -m and -F
Johan Herland [Sat, 13 Feb 2010 21:28:35 +0000 (22:28 +0100)]
builtin-notes: Refactor handling of -F option to allow combining -m and -F

By moving the -F option handling into a separate function (parse_file_arg),
we can start allowing several -F options, and mixed usage of -m and -F
options. Each -m/-F given appends to the note message, in the order they are
given on the command-line.

The patch includes tests verifying correct behaviour of the new functionality.

Signed-off-by: Johan Herland <johan@herland.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agobuiltin-notes: Deprecate the -m/-F options for "git notes edit"
Johan Herland [Sat, 13 Feb 2010 21:28:34 +0000 (22:28 +0100)]
builtin-notes: Deprecate the -m/-F options for "git notes edit"

The semantics for "git notes edit -m/-F" overlap with those for
"git notes add -f", and the behaviour (i.e. overwriting existing
notes with the given message/file) is more intuitively captured
by (and better documented with) "git notes add -f".

Suggested-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Johan Herland <johan@herland.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agobuiltin-notes: Add "append" subcommand for appending to note objects
Johan Herland [Sat, 13 Feb 2010 21:28:33 +0000 (22:28 +0100)]
builtin-notes: Add "append" subcommand for appending to note objects

"git notes append" is equivalent to "git notes edit" except that instead
of editing existing notes contents, you can only append to it. This is
useful for quickly adding annotations like e.g.:
git notes append -m "Acked-by: A U Thor <author@example.com>"

"git notes append" takes the same -m/-F options as "git notes add".

If there is no existing note to append to, "git notes append" is identical
to "git notes add" (i.e. it adds a new note).

The patch includes tests verifying correct behaviour of the new subcommand.

Suggested-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Johan Herland <johan@herland.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agobuiltin-notes: Add "add" subcommand for adding notes to objects
Johan Herland [Sat, 13 Feb 2010 21:28:32 +0000 (22:28 +0100)]
builtin-notes: Add "add" subcommand for adding notes to objects

"git notes add" is identical to "git notes edit" except that instead of
editing existing notes for a given object, you can only add notes to an
object that currently has none. If "git notes add" finds existing notes
for the given object, the addition is aborted. However, if the new
-f/--force option is used, "git notes add" will _overwrite_ the existing
notes with the new notes contents.

If there is no existing notes for the given object. "git notes add" is
identical to "git notes edit" (i.e. it adds a new note).

The patch includes tests verifying correct behaviour of the new subcommand.

Suggested-by: Joey Hess <joey@kitenet.net>
Improved-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Johan Herland <johan@herland.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agobuiltin-notes: Add --message/--file aliases for -m/-F options
Johan Herland [Sat, 13 Feb 2010 21:28:31 +0000 (22:28 +0100)]
builtin-notes: Add --message/--file aliases for -m/-F options

Signed-off-by: Johan Herland <johan@herland.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agobuiltin-notes: Add "list" subcommand for listing note objects
Johan Herland [Sat, 13 Feb 2010 21:28:30 +0000 (22:28 +0100)]
builtin-notes: Add "list" subcommand for listing note objects

"git notes list" will list all note objects in the current notes ref (in the
format "<note object> <annotated object>"). "git notes list <object>" will
list the note object associated with the given <object>, or fail loudly if
the given <object> has no associated notes.

If no arguments are given to "git notes", it defaults to the "list"
subcommand. This is for pseudo-compatibility with "git tag" and "git branch".

The patch includes tests verifying correct behaviour of the new subcommand.

Suggested-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Johan Herland <johan@herland.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agoDocumentation: Generalize git-notes docs to 'objects' instead of 'commits'
Johan Herland [Sat, 13 Feb 2010 21:28:29 +0000 (22:28 +0100)]
Documentation: Generalize git-notes docs to 'objects' instead of 'commits'

Notes can annotate arbitrary objects (not only commits), but this is not
reflected in the current documentation.

This patch rewrites the git-notes documentation to talk about 'objects'
instead of 'commits'. However, the discussion on commit notes and how
they are displayed by 'git log' is largely preserved.

Finally, I add myself to the Author/Documentation credits, since most of
the lines in the git-notes code and docs are blamed on me.

Cc: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Johan Herland <johan@herland.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agobuiltin-notes: Add "prune" subcommand for removing notes for missing objects
Johan Herland [Sat, 13 Feb 2010 21:28:28 +0000 (22:28 +0100)]
builtin-notes: Add "prune" subcommand for removing notes for missing objects

"git notes prune" will remove all notes that annotate unreachable/non-
existing objects.

The patch includes tests verifying correct behaviour of the new subcommand.

Suggested-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Johan Herland <johan@herland.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agoNotes API: prune_notes(): Prune notes that belong to non-existing objects
Johan Herland [Sat, 13 Feb 2010 21:28:27 +0000 (22:28 +0100)]
Notes API: prune_notes(): Prune notes that belong to non-existing objects

When an object is made unreachable by Git, any notes that annotate that object
are not automagically made unreachable, since all notes are always trivially
reachable from a notes ref. In order to remove notes for non-existing objects,
we therefore need to add functionality for traversing the notes tree and
explicitly removing references to notes that annotate non-reachable objects.
Thus the notes objects themselves also become unreachable, and are removed
by a later garbage collect.

prune_notes() performs this traversal (by using for_each_note() internally),
and removes the notes in question from the notes tree.

Note that the effect of prune_notes() is not persistent unless a subsequent
call to write_notes_tree() is made.

Signed-off-by: Johan Herland <johan@herland.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agot3305: Verify that removing notes triggers automatic fanout consolidation
Johan Herland [Sat, 13 Feb 2010 21:28:26 +0000 (22:28 +0100)]
t3305: Verify that removing notes triggers automatic fanout consolidation

Signed-off-by: Johan Herland <johan@herland.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agobuiltin-notes: Add "remove" subcommand for removing existing notes
Johan Herland [Sat, 13 Feb 2010 21:28:25 +0000 (22:28 +0100)]
builtin-notes: Add "remove" subcommand for removing existing notes

Using "git notes remove" is equivalent to specifying an empty note message.

The patch includes tests verifying correct behaviour of the new subcommand.

Signed-off-by: Johan Herland <johan@herland.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agoTeach builtin-notes to remove empty notes
Johan Herland [Sat, 13 Feb 2010 21:28:24 +0000 (22:28 +0100)]
Teach builtin-notes to remove empty notes

When the result of editing a note is an empty string, the associated note
entry should be deleted from the notes tree.

This allows deleting notes by invoking either "git notes -m ''" or
"git notes -F /dev/null".

Signed-off-by: Johan Herland <johan@herland.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agoTeach notes code to properly preserve non-notes in the notes tree
Johan Herland [Sat, 13 Feb 2010 21:28:23 +0000 (22:28 +0100)]
Teach notes code to properly preserve non-notes in the notes tree

The note tree structure allows for non-note entries to coexist with note
entries in a notes tree. Although we certainly expect there to be very
few non-notes in a notes tree, we should still support them to a certain
degree.

This patch teaches the notes code to preserve non-notes when updating the
notes tree with write_notes_tree(). Non-notes are not affected by fanout
restructuring.

For non-notes to be handled correctly, we can no longer allow subtree
entries that do not match the fanout structure produced by the notes code
itself. This means that fanouts like 4/36, 6/34, 8/32, 4/4/32, etc. are
no longer recognized as note subtrees; only 2-based fanouts are allowed
(2/38, 2/2/36, 2/2/2/34, etc.). Since the notes code has never at any point
_produced_ non-2-based fanouts, it is highly unlikely that this change will
cause problems for anyone.

The patch also adds some tests verifying the correct handling of non-notes
in a notes tree.

Signed-off-by: Johan Herland <johan@herland.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agot3305: Verify that adding many notes with git-notes triggers increased fanout
Johan Herland [Sat, 13 Feb 2010 21:28:22 +0000 (22:28 +0100)]
t3305: Verify that adding many notes with git-notes triggers increased fanout

Add a test verifying that the notes code automatically restructures the
notes tree into a deeper fanout level, when many notes are added with
"git notes".

Signed-off-by: Johan Herland <johan@herland.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agot3301: Verify successful annotation of non-commits
Johan Herland [Sat, 13 Feb 2010 21:28:21 +0000 (22:28 +0100)]
t3301: Verify successful annotation of non-commits

Adds a testcase verifying that git-notes works successfully on
tree, blob, and tag objects.

Signed-off-by: Johan Herland <johan@herland.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agoBuiltin-ify git-notes
Johan Herland [Sat, 13 Feb 2010 21:28:20 +0000 (22:28 +0100)]
Builtin-ify git-notes

The builtin-ification includes some minor behavioural changes to the
command-line interface: It is no longer allowed to mix the -m and -F
arguments, and it is not allowed to use multiple -F options.

As part of the builtin-ification, we add the commit_notes() function
to the builtin API. This function (together with the notes.h API) can
be easily used from other builtins to manipulate the notes tree.

Also includes needed changes to t3301.

This patch has been improved by the following contributions:
- Stephen Boyd: Use die() instead of fprintf(stderr, ...) followed by exit(1)

Cc: Stephen Boyd <bebarino@gmail.com>
Signed-off-by: Johan Herland <johan@herland.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agoRefactor notes concatenation into a flexible interface for combining notes
Johan Herland [Sat, 13 Feb 2010 21:28:19 +0000 (22:28 +0100)]
Refactor notes concatenation into a flexible interface for combining notes

When adding a note to an object that already has an existing note, the
current solution is to concatenate the contents of the two notes. However,
the caller may instead wish to _overwrite_ the existing note with the new
note, or maybe even _ignore_ the new note, and keep the existing one. There
might also be other ways of combining notes that are only known to the
caller.

Therefore, instead of unconditionally concatenating notes, we let the caller
specify how to combine notes, by passing in a pointer to a function for
combining notes. The caller may choose to implement its own function for
notes combining, but normally one of the following three conveniently
supplied notes combination functions will be sufficient:

- combine_notes_concatenate() combines the two notes by appending the
  contents of the new note to the contents of the existing note.

- combine_notes_overwrite() replaces the existing note with the new note.

- combine_notes_ignore() keeps the existing note, and ignores the new note.

A combine_notes function can be passed to init_notes() to choose a default
combine_notes function for that notes tree. If NULL is given, the notes tree
falls back to combine_notes_concatenate() as the ultimate default.

A combine_notes function can also be passed directly to add_note(), to
control the notes combining behaviour for a note addition in particular.
If NULL is passed, the combine_notes function registered for the given
notes tree is used.

Signed-off-by: Johan Herland <johan@herland.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agoNotes API: Allow multiple concurrent notes trees with new struct notes_tree
Johan Herland [Sat, 13 Feb 2010 21:28:18 +0000 (22:28 +0100)]
Notes API: Allow multiple concurrent notes trees with new struct notes_tree

The new struct notes_tree encapsulates access to a specific notes tree.
It is provided to allow callers to make use of several different notes trees
simultaneously.

A struct notes_tree * parameter is added to every function in the notes API.
In all cases, NULL can be passed, in which case the fallback "default" notes
tree (default_notes_tree) is used.

Signed-off-by: Johan Herland <johan@herland.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agoNotes API: write_notes_tree(): Store the notes tree in the database
Johan Herland [Sat, 13 Feb 2010 21:28:17 +0000 (22:28 +0100)]
Notes API: write_notes_tree(): Store the notes tree in the database

Uses for_each_note() to traverse the notes tree, and produces tree
objects on the fly representing the "on-disk" version of the notes
tree with appropriate fanout.

Signed-off-by: Johan Herland <johan@herland.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agoNotes API: for_each_note(): Traverse the entire notes tree with a callback
Johan Herland [Sat, 13 Feb 2010 21:28:16 +0000 (22:28 +0100)]
Notes API: for_each_note(): Traverse the entire notes tree with a callback

This includes a first attempt at creating an optimal fanout scheme (which
is calculated on-the-fly, while traversing).

Signed-off-by: Johan Herland <johan@herland.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agoNotes API: get_note(): Return the note annotating the given object
Johan Herland [Sat, 13 Feb 2010 21:28:15 +0000 (22:28 +0100)]
Notes API: get_note(): Return the note annotating the given object

Created by a simple cleanup and rename of lookup_notes().

Signed-off-by: Johan Herland <johan@herland.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agoNotes API: remove_note(): Remove note objects from the notes tree structure
Johan Herland [Sat, 13 Feb 2010 21:28:14 +0000 (22:28 +0100)]
Notes API: remove_note(): Remove note objects from the notes tree structure

This includes adding internal functions for maintaining a healthy notes tree
structure after removing individual notes.

Signed-off-by: Johan Herland <johan@herland.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agoNotes API: add_note(): Add note objects to the internal notes tree structure
Johan Herland [Sat, 13 Feb 2010 21:28:13 +0000 (22:28 +0100)]
Notes API: add_note(): Add note objects to the internal notes tree structure

Signed-off-by: Johan Herland <johan@herland.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agoNotes API: init_notes(): Initialize the notes tree from the given notes ref
Johan Herland [Sat, 13 Feb 2010 21:28:12 +0000 (22:28 +0100)]
Notes API: init_notes(): Initialize the notes tree from the given notes ref

Created by a simple refactoring of initialize_notes().

Also add a new 'flags' parameter, which is a bitwise combination of notes
initialization flags. For now, there is only one flag - NOTES_INIT_EMPTY -
which indicates that the notes tree should not auto-load the contents of
the given (or default) notes ref, but rather should leave the notes tree
initialized to an empty state. This will become useful in the future when
manipulating the notes tree through the notes API.

Signed-off-by: Johan Herland <johan@herland.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agoAdd tests for checking correct handling of $GIT_NOTES_REF and core.notesRef
Johan Herland [Sat, 13 Feb 2010 21:28:11 +0000 (22:28 +0100)]
Add tests for checking correct handling of $GIT_NOTES_REF and core.notesRef

Signed-off-by: Johan Herland <johan@herland.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agoNotes API: get_commit_notes() -> format_note() + remove the commit restriction
Johan Herland [Sat, 13 Feb 2010 21:28:10 +0000 (22:28 +0100)]
Notes API: get_commit_notes() -> format_note() + remove the commit restriction

There is really no reason why only commit objects can be annotated. By
changing the struct commit parameter to get_commit_notes() into a sha1 we
gain the ability to annotate any object type. To reflect this in the function
naming as well, we rename get_commit_notes() to format_note().

This patch also fixes comments and variable names throughout notes.c as a
consequence of the removal of the unnecessary 'commit' restriction.

Signed-off-by: Johan Herland <johan@herland.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agoMinor cosmetic fixes to notes.c
Johan Herland [Sat, 13 Feb 2010 21:28:09 +0000 (22:28 +0100)]
Minor cosmetic fixes to notes.c

Signed-off-by: Johan Herland <johan@herland.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agoMerge branch 'jc/maint-limit-note-output'
Junio C Hamano [Sat, 23 Jan 2010 00:08:01 +0000 (16:08 -0800)]
Merge branch 'jc/maint-limit-note-output'

* jc/maint-limit-note-output:
  Fix "log --oneline" not to show notes
  Fix "log" family not to be too agressive about showing notes

11 years agoMerge branch 'nd/ls-files-sparse-fix'
Junio C Hamano [Sat, 23 Jan 2010 00:07:18 +0000 (16:07 -0800)]
Merge branch 'nd/ls-files-sparse-fix'

* nd/ls-files-sparse-fix:
  Fix memory corruption when .gitignore does not end by \n

11 years agoMake difftool.prompt fall back to mergetool.prompt
Sebastian Schuberth [Fri, 22 Jan 2010 16:36:36 +0000 (17:36 +0100)]
Make difftool.prompt fall back to mergetool.prompt

The documentation states that "git-difftool falls back to git-mergetool
config variables when the difftool equivalents have not been defined".
Until now, this was not the case for "difftool.prompt".

Signed-off-by: Sebastian Schuberth <sschuberth@gmail.com>
Acked-by: David Aguilar <davvid@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agoengine.pl: Fix a recent breakage of the buildsystem generator
Ramsay Jones [Fri, 22 Jan 2010 20:00:47 +0000 (20:00 +0000)]
engine.pl: Fix a recent breakage of the buildsystem generator

Commit ade2ca0c (Do not try to remove directories when removing
old links, 2009-10-27) added an expression to a 'test' using an
'-o' or connective. This resulted in the buildsystem generator
mistaking a conditional 'rm' for a linker command. In order to
fix the breakage, we filter out all 'test' commands before then
attempting to identify the commands of interest.

Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
Acked-by: Sebastian Schuberth <sschuberth@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agogit-mv: fix moving more than one source to a single destination
Junio C Hamano [Fri, 22 Jan 2010 22:17:06 +0000 (14:17 -0800)]
git-mv: fix moving more than one source to a single destination

The code used as if return value from basename(3) were stable, but
often the function is implemented to return a pointer to a static
storage internal to it.

Because basename(3) is also allowed to modify its input parameter in
place, casting constness away from the strings we obtained from the
caller and giving them to basename is a no-no.

Reported, and initial fix and test supplied by David Rydh.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agorebase -i: Enclose sed command substitution in quotes
Michael Haggerty [Fri, 22 Jan 2010 09:22:30 +0000 (10:22 +0100)]
rebase -i: Enclose sed command substitution in quotes

Reported by: Johannes Sixt <j.sixt@viscovery.net>

Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agorebase -i: Avoid non-portable "test X -a Y"
Michael Haggerty [Fri, 22 Jan 2010 09:22:29 +0000 (10:22 +0100)]
rebase -i: Avoid non-portable "test X -a Y"

Reported by: Eric Blake <ebb9@byu.net>

Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agomake "index-pack" a built-in
Linus Torvalds [Fri, 22 Jan 2010 15:55:19 +0000 (07:55 -0800)]
make "index-pack" a built-in

This required some fairly trivial packfile function 'const' cleanup,
since the builtin commands get a const char *argv[] array.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agomake "git pack-redundant" a built-in
Linus Torvalds [Fri, 22 Jan 2010 15:42:14 +0000 (07:42 -0800)]
make "git pack-redundant" a built-in

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agomake "git unpack-file" a built-in
Linus Torvalds [Fri, 22 Jan 2010 15:38:03 +0000 (07:38 -0800)]
make "git unpack-file" a built-in

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agomake "mktag" a built-in
Linus Torvalds [Fri, 22 Jan 2010 15:34:44 +0000 (07:34 -0800)]
make "mktag" a built-in

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agomake "merge-index" a built-in
Linus Torvalds [Fri, 22 Jan 2010 15:29:21 +0000 (07:29 -0800)]
make "merge-index" a built-in

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agomerge-tree: remove unnecessary call of git_extract_argv0_path
Johannes Sixt [Fri, 22 Jan 2010 11:47:59 +0000 (12:47 +0100)]
merge-tree: remove unnecessary call of git_extract_argv0_path

This call should have been removed when the utility was made a builtin by
907a7cb.

Signed-off-by: Johannes Sixt <j6t@kdbg.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agomake "git patch-id" a built-in
Linus Torvalds [Fri, 22 Jan 2010 04:31:25 +0000 (20:31 -0800)]
make "git patch-id" a built-in

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agomake "git var" a built-in
Linus Torvalds [Fri, 22 Jan 2010 04:21:55 +0000 (20:21 -0800)]
make "git var" a built-in

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agofix git-p4 editor invocation
Nicolas Pitre [Fri, 22 Jan 2010 05:55:15 +0000 (00:55 -0500)]
fix git-p4 editor invocation

The strip() is required to remove the trailing newline character,
as already done elsewhere.

Signed-off-by: Nicolas Pitre <nico@fluxnic.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agoDocumentation: improve description of --glob=pattern and friends
Thomas Rast [Fri, 22 Jan 2010 00:21:38 +0000 (01:21 +0100)]
Documentation: improve description of --glob=pattern and friends

Consolidate the descriptions of --branches, --tags and --remotes a
bit, to make it less repetitive.  Improve the grammar a bit, and spell
out the meaning of the 'append /*' rule.

Signed-off-by: Thomas Rast <trast@student.ethz.ch>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agoMerge branch 'maint'
Junio C Hamano [Fri, 22 Jan 2010 04:08:31 +0000 (20:08 -0800)]
Merge branch 'maint'

* maint:
  merge-recursive: do not return NULL only to cause segfault
  retry request without query when info/refs?query fails

11 years agomake "git hash-object" a built-in
Linus Torvalds [Fri, 22 Jan 2010 03:50:11 +0000 (19:50 -0800)]
make "git hash-object" a built-in

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agomake "git merge-tree" a built-in
Linus Torvalds [Fri, 22 Jan 2010 02:25:20 +0000 (18:25 -0800)]
make "git merge-tree" a built-in

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agoslim down "git show-index"
Linus Torvalds [Thu, 21 Jan 2010 23:25:19 +0000 (15:25 -0800)]
slim down "git show-index"

As the documentation says, this is primarily for debugging, and
in the longer term we should rename it to test-show-index or something.

In the meantime, just avoid xmalloc (which slurps in the rest of git), and
separating out the trivial hex functions into "hex.o".

This results in

  [torvalds@nehalem git]$ size git-show-index
       text    data     bss     dec     hex filename
     222818    2276  112688  337782   52776 git-show-index (before)
       5696     624    1264    7584    1da0 git-show-index (after)

which is a whole lot better.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agoRemove diff machinery dependency from read-cache
Linus Torvalds [Thu, 21 Jan 2010 19:37:38 +0000 (11:37 -0800)]
Remove diff machinery dependency from read-cache

Exal Sibeaz pointed out that some git files are way too big, and that
add_files_to_cache() brings in all the diff machinery to any git binary
that needs the basic git SHA1 object operations from read-cache.c. Which
is pretty much all of them.

It's doubly silly, since add_files_to_cache() is only used by builtin
programs (add, checkout and commit), so it's fairly easily fixed by just
moving the thing to builtin-add.c, and avoiding the dependency entirely.

I initially argued to Exal that it would probably be best to try to depend
on smart compilers and linkers, but after spending some time trying to
make -ffunction-sections work and giving up, I think Exal was right, and
the fix is to just do some trivial cleanups like this.

This trivial cleanup results in pretty stunning file size differences.
The diff machinery really is mostly used by just the builtin programs, and
you have things like these trivial before-and-after numbers:

  -rwxr-xr-x 1 torvalds torvalds 1727420 2010-01-21 10:53 git-hash-object
  -rwxrwxr-x 1 torvalds torvalds  940265 2010-01-21 11:16 git-hash-object

Now, I'm not saying that 940kB is good either, but that's mostly all the
debug information - you can see the real code with 'size':

   text    data     bss     dec     hex filename
 418675    3920  127408  550003   86473 git-hash-object (before)
 230650    2288  111728  344666   5425a git-hash-object (after)

ie we have a nice 24% size reduction from this trivial cleanup.

It's not just that one file either. I get:

[torvalds@nehalem git]$ du -s /home/torvalds/libexec/git-core
45640 /home/torvalds/libexec/git-core (before)
33508 /home/torvalds/libexec/git-core (after)

so we're talking 12MB of diskspace here.

(Of course, stripping all the binaries brings the 33MB down to 9MB, so the
whole debug information thing is still the bulk of it all, but that's a
separate issue entirely)

Now, I'm sure there are other things we should do, and changing our
compiler flags from -O2 to -Os would bring the text size down by an
additional almost 20%, but this thing Exal pointed out seems to be some
good low-hanging fruit.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agomerge-recursive: do not return NULL only to cause segfault
Junio C Hamano [Fri, 22 Jan 2010 00:38:56 +0000 (16:38 -0800)]
merge-recursive: do not return NULL only to cause segfault

merge-recursive calls write_tree_from_memory() to come up with a virtual
tree, with possible conflict markers inside the blob contents, while
merging multiple common ancestors down.  It is a bug to call the function
with unmerged entries in the index, even if the merge to come up with the
common ancestor resulted in conflicts.  Otherwise the result won't be
expressible as a tree object.

We _might_ want to suggest the user to set GIT_MERGE_VERBOSITY to 5 and
re-run the merge in the message.  At least we will know which part of
process_renames() or process_entry() functions is not correctly handling
the unmerged paths, and it might help us diagnosing the issue.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agogit-rebase.txt: Fix spelling
Horst H. von Brand [Thu, 21 Jan 2010 20:34:25 +0000 (17:34 -0300)]
git-rebase.txt: Fix spelling

Signed-off-by: Horst H. von Brand <vonbrand@inf.utfsm.cl>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agoretry request without query when info/refs?query fails
Tay Ray Chuan [Thu, 21 Jan 2010 14:41:00 +0000 (22:41 +0800)]
retry request without query when info/refs?query fails

When "info/refs" is a static file and not behind a CGI handler, some
servers may not handle a GET request for it with a query string
appended (eg. "?foo=bar") properly.

If such a request fails, retry it sans the query string. In addition,
ensure that the "smart" http protocol is not used (a service has to be
specified with "?service=<service name>" to be conformant).

Signed-off-by: Tay Ray Chuan <rctay89@gmail.com>
Reported-and-tested-by: Yaroslav Halchenko <debian@onerussian.com>
Acked-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agoFix "log --oneline" not to show notes
Junio C Hamano [Thu, 21 Jan 2010 22:57:41 +0000 (14:57 -0800)]
Fix "log --oneline" not to show notes

This option should be treated pretty much the same as --format="%h %s".

Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agoMake 'rerere forget' work from a subdirectory.
Johannes Sixt [Thu, 21 Jan 2010 08:23:48 +0000 (09:23 +0100)]
Make 'rerere forget' work from a subdirectory.

It forgot to apply the prefix to the paths given on the command line.

[jc: added test]

Signed-off-by: Johannes Sixt <j6t@kdbg.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agoMake test case numbers unique
Johannes Sixt [Thu, 21 Jan 2010 07:57:03 +0000 (08:57 +0100)]
Make test case numbers unique

Signed-off-by: Johannes Sixt <j6t@kdbg.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agoconflict-marker-size: add test and docs
Junio C Hamano [Thu, 21 Jan 2010 07:49:27 +0000 (23:49 -0800)]
conflict-marker-size: add test and docs

Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agoUpdate draft release notes to 1.7.0
Junio C Hamano [Thu, 21 Jan 2010 07:30:45 +0000 (23:30 -0800)]
Update draft release notes to 1.7.0

Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agoMerge branch 'bw/cvsimport'
Junio C Hamano [Thu, 21 Jan 2010 04:28:51 +0000 (20:28 -0800)]
Merge branch 'bw/cvsimport'

* bw/cvsimport:
  cvsimport: standarize system() calls to external git tools
  cvsimport: standarize open() calls to external git tools
  cvsimport: modernize callouts to git subcommands

11 years agoMerge branch 'jc/checkout-merge-base'
Junio C Hamano [Thu, 21 Jan 2010 04:28:51 +0000 (20:28 -0800)]
Merge branch 'jc/checkout-merge-base'

* jc/checkout-merge-base:
  Fix "checkout A..." synonym for "checkout A...HEAD" on Windows

11 years agoMerge branch 'ag/patch-header-verify'
Junio C Hamano [Thu, 21 Jan 2010 04:28:51 +0000 (20:28 -0800)]
Merge branch 'ag/patch-header-verify'

* ag/patch-header-verify:
  builtin-apply.c: fix the --- and +++ header filename consistency check

11 years agoMerge branch 'jc/conflict-marker-size'
Junio C Hamano [Thu, 21 Jan 2010 04:28:51 +0000 (20:28 -0800)]
Merge branch 'jc/conflict-marker-size'

* jc/conflict-marker-size:
  rerere: honor conflict-marker-size attribute
  rerere: prepare for customizable conflict marker length
  conflict-marker-size: new attribute
  rerere: use ll_merge() instead of using xdl_merge()
  merge-tree: use ll_merge() not xdl_merge()
  xdl_merge(): allow passing down marker_size in xmparam_t
  xdl_merge(): introduce xmparam_t for merge specific parameters
  git_attr(): fix function signature

Conflicts:
builtin-merge-file.c
ll-merge.c
xdiff/xdiff.h
xdiff/xmerge.c

11 years agoMerge branch 'ag/maint-apply-too-large-p'
Junio C Hamano [Thu, 21 Jan 2010 04:28:50 +0000 (20:28 -0800)]
Merge branch 'ag/maint-apply-too-large-p'

* ag/maint-apply-too-large-p:
  builtin-apply.c: Skip filenames without enough components

11 years agoMerge branch 'ap/merge-backend-opts'
Junio C Hamano [Thu, 21 Jan 2010 04:28:50 +0000 (20:28 -0800)]
Merge branch 'ap/merge-backend-opts'

* ap/merge-backend-opts:
  Document that merge strategies can now take their own options
  Extend merge-subtree tests to test -Xsubtree=dir.
  Make "subtree" part more orthogonal to the rest of merge-recursive.
  pull: Fix parsing of -X<option>
  Teach git-pull to pass -X<option> to git-merge
  git merge -X<option>
  git-merge-file --ours, --theirs

Conflicts:
git-compat-util.h

11 years agoMerge branch 'nd/status-partial-refresh'
Junio C Hamano [Thu, 21 Jan 2010 04:28:50 +0000 (20:28 -0800)]
Merge branch 'nd/status-partial-refresh'

* nd/status-partial-refresh:
  rm: only refresh entries that we may touch
  status: only touch path we may need to check

11 years agoMerge remote branch 'remotes/trast-doc/for-next'
Junio C Hamano [Thu, 21 Jan 2010 04:28:49 +0000 (20:28 -0800)]
Merge remote branch 'remotes/trast-doc/for-next'

* remotes/trast-doc/for-next:
  Documentation: spell 'git cmd' without dash throughout
  Documentation: format full commands in typewriter font
  Documentation: warn prominently against merging with dirty trees
  Documentation/git-merge: reword references to "remote" and "pull"

Conflicts:
Documentation/config.txt
Documentation/git-config.txt
Documentation/git-merge.txt

11 years agoMerge branch 'jh/notes' (early part)
Junio C Hamano [Thu, 21 Jan 2010 04:28:49 +0000 (20:28 -0800)]
Merge branch 'jh/notes' (early part)

* 'jh/notes' (early part):
  Add more testcases to test fast-import of notes
  Rename t9301 to t9350, to make room for more fast-import tests
  fast-import: Proper notes tree manipulation

11 years agoMerge branch 'maint'
Junio C Hamano [Thu, 21 Jan 2010 04:28:39 +0000 (20:28 -0800)]
Merge branch 'maint'

* maint:
  status: don't require the repository to be writable

Conflicts:
builtin-commit.c

11 years agoMerge branch 'jc/maint-refresh-index-is-optional-for-status' into maint
Junio C Hamano [Thu, 21 Jan 2010 04:25:11 +0000 (20:25 -0800)]
Merge branch 'jc/maint-refresh-index-is-optional-for-status' into maint

* jc/maint-refresh-index-is-optional-for-status:
  status: don't require the repository to be writable

11 years agoFix memory corruption when .gitignore does not end by \n
Nguyễn Thái Ngọc Duy [Wed, 20 Jan 2010 14:09:16 +0000 (21:09 +0700)]
Fix memory corruption when .gitignore does not end by \n

Commit b5041c5 (Avoid writing to buffer in add_excludes_from_file_1())
tried not to append '\n' at the end because the next commit
may return a buffer that does not have extra space for that.

Unfortunately it left this assignment in the loop:

  buf[i - (i && buf[i-1] == '\r')] = 0;

that can corrupt memory if "buf" is not '\n' terminated. But even if
it does not corrupt memory, the last line would not be
NULL-terminated, leading to errors later inside add_exclude().

This patch fixes it by reverting the faulty commit and make
sure "buf" is always \n terminated.

While at it, free unused memory properly.

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agoFix "log" family not to be too agressive about showing notes
Junio C Hamano [Wed, 20 Jan 2010 21:59:36 +0000 (13:59 -0800)]
Fix "log" family not to be too agressive about showing notes

Giving "Notes" information in the default output format of "log" and
"show" is a sensible progress (the user has asked for it by having the
notes), but for some commands (e.g. "format-patch") spewing notes into the
formatted commit log message without being asked is too aggressive.

Enable notes output only for "log", "show", "whatchanged" by default and
only when the user didn't ask any specific --pretty/--format from the
command line; users can explicitly override this default with --show-notes
and --no-notes option.

Parts of tests are taken from Jeff King's fix.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agoMerge branch 'rr/core-tutorial'
Junio C Hamano [Wed, 20 Jan 2010 23:24:42 +0000 (15:24 -0800)]
Merge branch 'rr/core-tutorial'

* rr/core-tutorial:
  Documentation: Update git core tutorial clarifying reference to scripts

11 years agoMerge branch 'jc/cache-unmerge'
Junio C Hamano [Wed, 20 Jan 2010 22:44:31 +0000 (14:44 -0800)]
Merge branch 'jc/cache-unmerge'

* jc/cache-unmerge:
  rerere forget path: forget recorded resolution
  rerere: refactor rerere logic to make it independent from I/O
  rerere: remove silly 1024-byte line limit
  resolve-undo: teach "update-index --unresolve" to use resolve-undo info
  resolve-undo: "checkout -m path" uses resolve-undo information
  resolve-undo: allow plumbing to clear the information
  resolve-undo: basic tests
  resolve-undo: record resolved conflicts in a new index extension section
  builtin-merge.c: use standard active_cache macros

Conflicts:
builtin-ls-files.c
builtin-merge.c
builtin-rerere.c

11 years agoMerge branch 'js/exec-error-report'
Junio C Hamano [Wed, 20 Jan 2010 22:44:12 +0000 (14:44 -0800)]
Merge branch 'js/exec-error-report'

* js/exec-error-report:
  Improve error message when a transport helper was not found
  start_command: detect execvp failures early
  run-command: move wait_or_whine earlier
  start_command: report child process setup errors to the parent's stderr

Conflicts:
Makefile

11 years agoMerge branch 'jc/ls-files-ignored-pathspec'
Junio C Hamano [Wed, 20 Jan 2010 22:43:54 +0000 (14:43 -0800)]
Merge branch 'jc/ls-files-ignored-pathspec'

* jc/ls-files-ignored-pathspec:
  ls-files: fix overeager pathspec optimization
  read_directory(): further split treat_path()
  read_directory_recursive(): refactor handling of a single path into a separate function
  t3001: test ls-files -o ignored/dir

11 years agoMerge branch 'jc/grep-lookahead'
Junio C Hamano [Wed, 20 Jan 2010 22:43:41 +0000 (14:43 -0800)]
Merge branch 'jc/grep-lookahead'

* jc/grep-lookahead:
  grep --no-index: allow use of "git grep" outside a git repository
  grep: prepare to run outside of a work tree
  grep: rip out pessimization to use fixmatch()
  grep: rip out support for external grep
  grep: optimize built-in grep by skipping lines that do not hit

Conflicts:
builtin-grep.c
t/t7002-grep.sh

11 years agoMerge branch 'jc/maint-strbuf-add-fix-doubling'
Junio C Hamano [Wed, 20 Jan 2010 22:43:09 +0000 (14:43 -0800)]
Merge branch 'jc/maint-strbuf-add-fix-doubling'

* jc/maint-strbuf-add-fix-doubling:
  strbuf_addbuf(): allow passing the same buf to dst and src

11 years agoMerge branch 'mm/conflict-advice'
Junio C Hamano [Wed, 20 Jan 2010 22:42:59 +0000 (14:42 -0800)]
Merge branch 'mm/conflict-advice'

* mm/conflict-advice:
  Be more user-friendly when refusing to do something because of conflict.

Conflicts:
Documentation/config.txt
advice.c
advice.h

11 years agoMerge branch 'da/difftool'
Junio C Hamano [Wed, 20 Jan 2010 22:42:20 +0000 (14:42 -0800)]
Merge branch 'da/difftool'

* da/difftool:
  difftool: Update copyright notices to list each year separately
  difftool: Use eval to expand '--extcmd' expressions
  difftool: Add '-x' and as an alias for '--extcmd'
  t7800-difftool.sh: Simplify the --extcmd test
  git-diff.txt: Link to git-difftool
  difftool: Allow specifying unconfigured commands with --extcmd
  difftool--helper: Remove use of the GIT_MERGE_TOOL variable
  difftool--helper: Update copyright and remove distracting comments
  git-difftool: Add '--gui' for selecting a GUI tool
  t7800-difftool: Set a bogus tool for use by tests

11 years agoMerge branch 'mh/rebase-fixup'
Junio C Hamano [Wed, 20 Jan 2010 22:42:07 +0000 (14:42 -0800)]
Merge branch 'mh/rebase-fixup'

* mh/rebase-fixup:
  rebase -i: Retain user-edited commit messages after squash/fixup conflicts
  t3404: Set up more of the test repo in the "setup" step
  rebase -i: For fixup commands without squashes, do not start editor
  rebase -i: Change function make_squash_message into update_squash_message
  rebase -i: Extract function do_with_author
  rebase -i: Handle the author script all in one place in do_next
  rebase -i: Extract a function "commit_message"
  rebase -i: Simplify commit counting for generated commit messages
  rebase -i: Improve consistency of commit count in generated commit messages
  t3404: Test the commit count in commit messages generated by "rebase -i"
  rebase -i: Introduce a constant AMEND
  rebase -i: Introduce a constant AUTHOR_SCRIPT
  rebase -i: Document how temporary files are used
  rebase -i: Use symbolic constant $MSG consistently
  rebase -i: Use "test -n" instead of "test ! -z"
  rebase -i: Inline expression
  rebase -i: Remove dead code
  rebase -i: Make the condition for an "if" more transparent

11 years agoMerge branch 'ns/rebase-auto-squash'
Junio C Hamano [Wed, 20 Jan 2010 22:42:04 +0000 (14:42 -0800)]
Merge branch 'ns/rebase-auto-squash'

* ns/rebase-auto-squash:
  rebase -i --autosquash: auto-squash commits

Conflicts:
git-rebase--interactive.sh

11 years agoMerge branch 'mh/rebase-fixup' (early part)
Junio C Hamano [Wed, 20 Jan 2010 22:41:48 +0000 (14:41 -0800)]
Merge branch 'mh/rebase-fixup' (early part)

* 'mh/rebase-fixup' (early part):
  rebase-i: Ignore comments and blank lines in peek_next_command
  lib-rebase: Allow comments and blank lines to be added to the rebase script
  lib-rebase: Provide clearer debugging info about what the editor did
  Add a command "fixup" to rebase --interactive
  t3404: Use test_commit to set up test repository

11 years agoMerge branch 'il/push-set-upstream'
Junio C Hamano [Wed, 20 Jan 2010 22:40:48 +0000 (14:40 -0800)]
Merge branch 'il/push-set-upstream'

* il/push-set-upstream:
  Add push --set-upstream

Conflicts:
transport.c