From: Junio C Hamano <gitster@pobox.com>
To: Johan Herland <johan@herland.net>
Cc: git@vger.kernel.org
Subject: Re: [RFD/PATCH 5/5] RFD: Disallow out-of-refspec refs within refs/remotes/* to be used as upstream
Date: Fri, 19 Apr 2013 12:51:08 -0700 [thread overview]
Message-ID: <7vvc7iz4cz.fsf@alter.siamese.dyndns.org> (raw)
In-Reply-To: <1366352442-501-6-git-send-email-johan@herland.net> (Johan Herland's message of "Fri, 19 Apr 2013 08:20:42 +0200")
Johan Herland <johan@herland.net> 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/t7201-co.sh b/t/t7201-co.sh
> index be9672e..7267ee2 100755
> --- a/t/t7201-co.sh
> +++ b/t/t7201-co.sh
> @@ -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 &&
prev parent reply other threads:[~2013-04-19 19:51 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-04-19 6:20 [RFD/PATCH 0/5] Improving the search for remote-tracking branches Johan Herland
2013-04-19 6:20 ` [RFD/PATCH 1/5] t2024: Add tests verifying current DWIM behavior of 'git checkout <branch>' Johan Herland
2013-04-19 6:20 ` [RFD/PATCH 2/5] t2024: Show failure to use refspec when DWIMming remote branch names Johan Herland
2013-04-19 6:20 ` [RFD/PATCH 3/5] checkout: Use remote refspecs when DWIMming tracking branches Johan Herland
2013-04-19 19:44 ` Junio C Hamano
2013-04-20 8:05 ` Johan Herland
2013-04-19 6:20 ` [RFD/PATCH 4/5] branch.c: Look up refspecs to validate " Johan Herland
2013-04-19 6:20 ` [RFD/PATCH 5/5] RFD: Disallow out-of-refspec refs within refs/remotes/* to be used as upstream Johan Herland
2013-04-19 19:51 ` Junio C Hamano [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=7vvc7iz4cz.fsf@alter.siamese.dyndns.org \
--to=gitster@pobox.com \
--cc=git@vger.kernel.org \
--cc=johan@herland.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).