Johan Herland <> writes:

> The previous patch adds validation of upstream remote-tracking branches by
> parsing the configured refspecs, and making sure that the candidate upstream
> (if not already matching refs/heads/* or refs/remotes/*) is indeed a
> remote-tracking branch according to some remote's refspec. For a
> default/conventional setup, this check would automatically also cover
> everything within refs/remotes/*, meaning that the preceding check for
> refs/remotes/* is redundant (although quicker than the validation against
> refspecs). One could also argue that not everything inside refs/remotes/*
> should be automatically acceptable as an upstream, if one were to keep
> other (non-branch) type of remote-tracking refs there.
> This patch removes the simple check for refs/remotes/*, to make sure that
> _only_ validated remote-tracking branches (in addition to local branches)
> are allowed as upstreams.
> However, this means that for unconventional setups that place refs within
> refs/remotes/* without configuring a corresponding refspec, those refs will
> no longer be usable as upstreams. This breaks a few existing tests, which
> are marked as test_expect_failure by this patch, to make them easy to find.

I think these tests are too loosely written, making assumptions on
what the back-then-current implementation actually does.

If refs/remotes/origin/koala/bear is a remote tracking branch for
koala/bear branch taken from the origin, we will have a refspec that
stores to refs/remotes/origin/koala/bear for _some_ remote (and in
the most normal case it would be "origin").

Instead of expecting failures, I think it is a better change to make
the test case more realistic by adding remote.origin.refspec as well.

> diff --git a/t/ b/t/
> index be9672e..7267ee2 100755
> --- a/t/
> +++ b/t/
> @@ -429,7 +429,7 @@ test_expect_success 'detach a symbolic link HEAD' '
>      test "z$(git rev-parse --verify refs/heads/master)" = "z$here"
>  '
> -test_expect_success \
> +test_expect_failure \
>      'checkout with --track fakes a sensible -b <name>' '
>      git update-ref refs/remotes/origin/koala/bear renamer &&
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to
More majordomo info at

Reply via email to