checkout: inform the user when removing branch state
After a successful switch, if a merge, cherry-pick or revert is ongoing,
it is canceled. This behavior has been with us from the very early
beginning, soon after git-merge was created but never actually
documented [1]. It may be a good idea to be transparent and tell the
user if some operation is canceled.
I consider this a better way of telling the user than just adding a
sentence or two in git-checkout.txt, which will be mostly ignored
anyway.
PS. Originally I wanted to print more details like
warning: cancelling an in-progress merge from <SHA-1>
which may allow some level of undo if the user wants to. But that seems
a lot more work. Perhaps it can be improved later if people still want
that.
[1] ... and I will try not to argue whether it is a sensible behavior.
There is some more discussion here if people are interested:
CACsJy8Axa5WsLSjiscjnxVK6jQHkfs-gH959=YtUvQkWriAk5w@mail.gmail.com
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
committed by
Junio C Hamano
parent
af9ded5b70
commit
f4a4b9aca3
@ -1272,7 +1272,7 @@ int cmd_rebase(int argc, const char **argv, const char *prefix)
|
||||
if (reset_head(NULL, "reset", NULL, RESET_HEAD_HARD,
|
||||
NULL, NULL) < 0)
|
||||
die(_("could not discard worktree changes"));
|
||||
remove_branch_state(the_repository);
|
||||
remove_branch_state(the_repository, 0);
|
||||
if (read_basic_state(&options))
|
||||
exit(1);
|
||||
goto run_rebase;
|
||||
@ -1292,7 +1292,7 @@ int cmd_rebase(int argc, const char **argv, const char *prefix)
|
||||
NULL, NULL) < 0)
|
||||
die(_("could not move back to %s"),
|
||||
oid_to_hex(&options.orig_head));
|
||||
remove_branch_state(the_repository);
|
||||
remove_branch_state(the_repository, 0);
|
||||
ret = finish_rebase(&options);
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user