summaryrefslogtreecommitdiff
path: root/builtin/reset.c
diff options
context:
space:
mode:
authorNguyễn Thái Ngọc Duy <pclouds@gmail.com>2019-03-29 10:38:59 (GMT)
committerJunio C Hamano <gitster@pobox.com>2019-04-02 04:56:59 (GMT)
commitf4a4b9aca3cb70fabe3e856fa61ca35a99e2b8eb (patch)
tree98ad7f525239f864d4d81fd664261b9e59dc5192 /builtin/reset.c
parentaf9ded5b7007a4fa9844be7ac1c86f7a6ef2e56a (diff)
downloadgit-f4a4b9aca3cb70fabe3e856fa61ca35a99e2b8eb.zip
git-f4a4b9aca3cb70fabe3e856fa61ca35a99e2b8eb.tar.gz
git-f4a4b9aca3cb70fabe3e856fa61ca35a99e2b8eb.tar.bz2
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>
Diffstat (limited to 'builtin/reset.c')
-rw-r--r--builtin/reset.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/builtin/reset.c b/builtin/reset.c
index 7882829..6d9397c 100644
--- a/builtin/reset.c
+++ b/builtin/reset.c
@@ -420,7 +420,7 @@ int cmd_reset(int argc, const char **argv, const char *prefix)
print_new_head_line(lookup_commit_reference(the_repository, &oid));
}
if (!pathspec.nr)
- remove_branch_state(the_repository);
+ remove_branch_state(the_repository, 0);
return update_ref_status;
}