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
This commit is contained in:
11
branch.c
11
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);
|
||||
|
||||
Reference in New Issue
Block a user