git-sh-setup: Fix scripts whose PWD is a symlink into a git work-dir
[gitweb.git] / branch.c
index 205b89dc697eb4475355ab5b2a6528e404901c0c..b1ac837f3d30c826ddbe29492b906bf2d0de0a1a 100644 (file)
--- a/branch.c
+++ b/branch.c
@@ -129,7 +129,9 @@ void create_branch(const char *head,
                        die("Cannot setup tracking information; starting point is not a branch.");
                break;
        case 1:
-               /* Unique completion -- good */
+               /* Unique completion -- good, only if it is a real ref */
+               if (track == BRANCH_TRACK_EXPLICIT && !strcmp(real_ref, "HEAD"))
+                       die("Cannot setup tracking information; starting point is not a branch.");
                break;
        default:
                die("Ambiguous object name: '%s'.", start_name);