diff options
author | Junio C Hamano <gitster@pobox.com> | 2011-03-15 14:22:13 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2011-03-15 14:22:13 -0700 |
commit | 663ee1a4c9b9caa4c8f446934410ca636f998df6 (patch) | |
tree | 16709d531edb349a53910e3f7dd7c4a306b73cbb /branch.c | |
parent | 936dfc220210bc00c7dc094250c9680620dab291 (diff) | |
parent | 21b5b1e8dc9bed2b518defe29d69ebc27da4b68f (diff) | |
download | git-663ee1a4c9b9caa4c8f446934410ca636f998df6.tar.gz git-663ee1a4c9b9caa4c8f446934410ca636f998df6.tar.xz |
Merge branch 'jh/maint-do-not-track-non-branches'
* 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); |