Skip to content

Commit

Permalink
Resurrect git-revert.sh example and add comment to builtin-revert.c
Browse files Browse the repository at this point in the history
I had to scratch my head for quite some time figuring out why we
cannot optimize out write_tree() we do when --no-commit option
is given, whose purpose seem to be only to check if the index is
unmerged, with a simple loop over the active_cache[].

So add a comment to describe why the write_tree() is there, and
resurrect the last scripted version as a reference material in
contrib/example directory with others.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
  • Loading branch information
Junio C Hamano committed Nov 13, 2007
1 parent f192c5d commit 71aa2b8
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion builtin-revert.c
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,9 @@ static int revert_or_cherry_pick(int argc, const char **argv)
if (no_commit) {
/*
* We do not intend to commit immediately. We just want to
* merge the differences in.
* merge the differences in, so let's compute the tree
* that represents the "current" state for merge-recursive
* to work on.
*/
if (write_tree(head, 0, NULL))
die ("Your index file is unmerged.");
Expand Down

0 comments on commit 71aa2b8

Please sign in to comment.