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>
Junio C Hamano committed
Nov 13, 2007 at 13:45 UTC
71aa2b8f0ee7cb2e60871f327996af21af88a668
1 file changed
+3
-1
builtin-revert.c
+3
-1
@@ -246,7 +246,9 @@ static int revert_or_cherry_pick(int argc, const char **argv)
246
if (no_commit) {
247
/*
248
* We do not intend to commit immediately. We just want to
249
- * merge the differences in.
249
+ * merge the differences in, so let's compute the tree
250
+ * that represents the "current" state for merge-recursive
251
+ * to work on.
252
*/
253
if (write_tree(head, 0, NULL))
254
die ("Your index file is unmerged.");