X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=branch.c;h=c0c865a4b1b0fca038f32b77f2239d7987438ff5;hb=7cf16a14f5c070f7b14cf28023769450133172ae;hp=93dc866f8c09a2da2308c4fd677178b043f2d4d5;hpb=1538f21bfb33dcaa65fe84b9823a8963bf1e6443;p=git.git diff --git a/branch.c b/branch.c index 93dc866f8..c0c865a4b 100644 --- a/branch.c +++ b/branch.c @@ -175,9 +175,14 @@ void create_branch(const char *head, die("Cannot setup tracking information; starting point is not a branch."); break; case 1: - /* Unique completion -- good, only if it is a real ref */ - if (explicit_tracking && !strcmp(real_ref, "HEAD")) - die("Cannot setup tracking information; starting point is not a branch."); + /* Unique completion -- good, only if it is a real branch */ + if (prefixcmp(real_ref, "refs/heads/") && + prefixcmp(real_ref, "refs/remotes/")) { + if (explicit_tracking) + die("Cannot setup tracking information; starting point is not a branch."); + else + real_ref = NULL; + } break; default: die("Ambiguous object name: '%s'.", start_name); @@ -217,6 +222,7 @@ void create_branch(const char *head, void remove_branch_state(void) { + unlink(git_path("CHERRY_PICK_HEAD")); unlink(git_path("MERGE_HEAD")); unlink(git_path("MERGE_RR")); unlink(git_path("MERGE_MSG"));