diff options
author | Junio C Hamano <gitster@pobox.com> | 2011-04-01 16:20:45 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2011-04-01 16:20:45 -0700 |
commit | ac53196d9a1f63785de199dee4b851378510f729 (patch) | |
tree | a14bd5b92d400f27ce75e8a660372e5e3bc4f202 /branch.c | |
parent | f35bb7c38d546a9e8360cde53c03b0b881ab4475 (diff) | |
parent | 21b5b1e8dc9bed2b518defe29d69ebc27da4b68f (diff) | |
download | git-ac53196d9a1f63785de199dee4b851378510f729.tar.gz git-ac53196d9a1f63785de199dee4b851378510f729.tar.xz |
Merge branch 'jh/maint-do-not-track-non-branches' into maint
* jh/maint-do-not-track-non-branches:
branch/checkout --track: Ensure that upstream branch is indeed a branch
Diffstat (limited to 'branch.c')
-rw-r--r-- | branch.c | 11 |
1 files changed, 8 insertions, 3 deletions
@@ -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); |