X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=branch.c;h=da5c03e56545b79cb92dd850ed09e81c21f9162f;hb=3967c995eed9f4046a1dde5ef520d1dbcdedfab8;hp=93dc866f8c09a2da2308c4fd677178b043f2d4d5;hpb=2e1e96126f93653badaa0afd17204e417dfc8e7d;p=git.git diff --git a/branch.c b/branch.c index 93dc866f8..da5c03e56 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);