X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;ds=inline;f=branch.c;h=c0c865a4b1b0fca038f32b77f2239d7987438ff5;hb=698a9ab3f104b369e41ad26ad0bdaedc3a1d5f4f;hp=93dc866f8c09a2da2308c4fd677178b043f2d4d5;hpb=5501bf854ce6a3847ef0de6f6aa63f6b93e82b67;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"));