summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2007-11-13 21:45:11 (GMT)
committerJunio C Hamano <gitster@pobox.com>2007-11-13 21:45:11 (GMT)
commit71aa2b8f0ee7cb2e60871f327996af21af88a668 (patch)
tree05852eb2d293bd35ebf70d0a1723a1e03b31c73d
parentf192c5d0fb37a1a89d88e92bb7b21418b57c2129 (diff)
downloadgit-71aa2b8f0ee7cb2e60871f327996af21af88a668.zip
git-71aa2b8f0ee7cb2e60871f327996af21af88a668.tar.gz
git-71aa2b8f0ee7cb2e60871f327996af21af88a668.tar.bz2
Resurrect git-revert.sh example and add comment to builtin-revert.c
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>
-rw-r--r--builtin-revert.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/builtin-revert.c b/builtin-revert.c
index 62ab1fa..afc2884 100644
--- a/builtin-revert.c
+++ b/builtin-revert.c
@@ -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.");