Code

Merge branch 'tt/help'
[git.git] / builtin-revert.c
index 62ab1fa1f484a113f45da96de8cd209a0c5c522e..a0586f9753189d13d5af1c790ea875a5f383f34f 100644 (file)
@@ -30,7 +30,7 @@ static const char * const cherry_pick_usage[] = {
        NULL
 };
 
-static int edit, no_replay, no_commit, needed_deref, mainline;
+static int edit, no_replay, no_commit, mainline;
 static enum { REVERT, CHERRY_PICK } action;
 static struct commit *commit;
 
@@ -66,7 +66,6 @@ static void parse_args(int argc, const char **argv)
        if (commit->object.type == OBJ_TAG) {
                commit = (struct commit *)
                        deref_tag((struct object *)commit, arg, strlen(arg));
-               needed_deref = 1;
        }
        if (commit->object.type != OBJ_COMMIT)
                die ("'%s' does not point to a commit", arg);
@@ -246,7 +245,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.");
@@ -256,7 +257,7 @@ static int revert_or_cherry_pick(int argc, const char **argv)
                if (get_sha1("HEAD", head))
                        die ("You do not have a valid HEAD");
                wt_status_prepare(&s);
-               if (s.commitable || s.workdir_dirty)
+               if (s.commitable)
                        die ("Dirty index: cannot %s", me);
                discard_cache();
        }
@@ -331,17 +332,6 @@ static int revert_or_cherry_pick(int argc, const char **argv)
                        add_to_msg(")\n");
                }
        }
-       if (needed_deref) {
-               add_to_msg("(original 'git ");
-               add_to_msg(me);
-               add_to_msg("' arguments: ");
-               for (i = 0; i < argc; i++) {
-                       if (i)
-                               add_to_msg(" ");
-                       add_to_msg(argv[i]);
-               }
-               add_to_msg(")\n");
-       }
 
        if (merge_recursive(sha1_to_hex(base->object.sha1),
                                sha1_to_hex(head), "HEAD",