sequencer: rename reset_for_rollback to reset_merge
authorRohit Ashiwal <rohit.ashiwal265@gmail.com>
Tue, 2 Jul 2019 09:11:26 +0000 (14:41 +0530)
committerJunio C Hamano <gitster@pobox.com>
Tue, 2 Jul 2019 19:08:07 +0000 (12:08 -0700)
We are on a path to teach cherry-pick/revert how to skip commits. To
achieve this, we could really make use of existing functions.
reset_for_rollback is one such function, but the name does not
intuitively suggest to use it to reset a merge, which it was born to
perform, see 539047c ("revert: introduce --abort to cancel a failed
cherry-pick", 2011-11-23). Change the name to reset_merge to make
it more intuitive.

Signed-off-by: Rohit Ashiwal <rohit.ashiwal265@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
sequencer.c
index acf4aa75f509ebd3dec314da84c2149301dccecb..e8779c7cc5049e9aaff04e3cc1f509dedd4f4f0e 100644 (file)
@@ -2732,7 +2732,7 @@ static int rollback_is_safe(void)
        return oideq(&actual_head, &expected_head);
 }
 
        return oideq(&actual_head, &expected_head);
 }
 
-static int reset_for_rollback(const struct object_id *oid)
+static int reset_merge(const struct object_id *oid)
 {
        const char *argv[4];    /* reset --merge <arg> + NULL */
 
 {
        const char *argv[4];    /* reset --merge <arg> + NULL */
 
@@ -2754,7 +2754,7 @@ static int rollback_single_pick(struct repository *r)
                return error(_("cannot resolve HEAD"));
        if (is_null_oid(&head_oid))
                return error(_("cannot abort from a branch yet to be born"));
                return error(_("cannot resolve HEAD"));
        if (is_null_oid(&head_oid))
                return error(_("cannot abort from a branch yet to be born"));
-       return reset_for_rollback(&head_oid);
+       return reset_merge(&head_oid);
 }
 
 int sequencer_rollback(struct repository *r, struct replay_opts *opts)
 }
 
 int sequencer_rollback(struct repository *r, struct replay_opts *opts)
@@ -2797,7 +2797,7 @@ int sequencer_rollback(struct repository *r, struct replay_opts *opts)
                warning(_("You seem to have moved HEAD. "
                          "Not rewinding, check your HEAD!"));
        } else
                warning(_("You seem to have moved HEAD. "
                          "Not rewinding, check your HEAD!"));
        } else
-       if (reset_for_rollback(&oid))
+       if (reset_merge(&oid))
                goto fail;
        strbuf_release(&buf);
        return sequencer_remove_state(opts);
                goto fail;
        strbuf_release(&buf);
        return sequencer_remove_state(opts);