Skip to content

Instantly share code, notes, and snippets.

@kimar
Created March 10, 2016 21:21
Show Gist options
  • Save kimar/45f40fe2a912c55ba4c0 to your computer and use it in GitHub Desktop.
Save kimar/45f40fe2a912c55ba4c0 to your computer and use it in GitHub Desktop.
Fixes an issue in Git that leads to being able to delete the currently checked out branch
diff --git a/builtin/branch.c b/builtin/branch.c
index 7b45b6b..46bde61 100644
--- a/builtin/branch.c
+++ b/builtin/branch.c
@@ -215,7 +215,7 @@ static int delete_branches(int argc, const char **argv, int force, int kinds,
int flags = 0;
strbuf_branchname(&bname, argv[i]);
- if (kinds == FILTER_REFS_BRANCHES && !strcmp(head, bname.buf)) {
+ if (kinds == FILTER_REFS_BRANCHES && !strcasecmp(head, bname.buf)) {
error(_("Cannot delete the branch '%s' "
"which you are currently on."), bname.buf);
ret = 1;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment