git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Felipe Contreras <felipe.contreras@gmail.com>
Cc: Git <git@vger.kernel.org>, Jeff King <peff@peff.net>,
	Brandon Williams <bwilliams.eng@gmail.com>,
	Jacob Keller <jacob.keller@gmail.com>,
	Tomo Krajina <tkrajina@gmail.com>
Subject: Re: [PATCH v2] refspec: make @ a synonym of HEAD
Date: Tue, 24 Nov 2020 17:53:11 -0800	[thread overview]
Message-ID: <xmqq360ygq2g.fsf@gitster.c.googlers.com> (raw)
In-Reply-To: <CAMP44s2ChcCjhjksS0s5BoYznqLAoXyFvSkP4GxSCh_ALusOtQ@mail.gmail.com> (Felipe Contreras's message of "Tue, 24 Nov 2020 18:43:29 -0600")

Felipe Contreras <felipe.contreras@gmail.com> writes:

> On Tue, Nov 24, 2020 at 6:37 PM Junio C Hamano <gitster@pobox.com> wrote:
>> Felipe Contreras <felipe.contreras@gmail.com> writes:
>
>> > +test_expect_success 'push with @' '
>> > +
>> > +     mk_test testrepo heads/master &&
>> > +     git checkout master &&
>> > +     git push testrepo @ &&
>> > +     check_push_result testrepo $the_commit heads/master
>> > +
>> > +'
>>
>> This is OK, but shouldn't this be placed before the tests with
>> various configuration?  Something along the lines of the attached,
>> but with the body of the loop properly reindented, would also give
>> us a better test coverage at the same time.
>
> I don't see much value in those tests, since I don't see how if one
> passes another one would fail. But I guess it cannot hurt.

That can only be said based on the knowledge of the implementation
detail of the code immediately after this patch gets applied.  Any
future change to the code for whatever reason (e.g. refactoring) can
make the current assumption invalid.

As the proposed log message says,

    Since commit 9ba89f484e git learned how to push to a remote branch using
    the source @, for example:

      git push origin @:$dst

    However, if the right-hand side is missing, the push fails:

      git push origin @

we care about both of these forms working, not just the singleton
form, so it is not just "not hurt", but is actively a good thing, to
protect both forms from future breakage.  After all, that is why we
have tests.

Thanks.



  reply	other threads:[~2020-11-25  1:53 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-25  0:11 [PATCH v2] refspec: make @ a synonym of HEAD Felipe Contreras
2020-11-25  0:36 ` Junio C Hamano
2020-11-25  0:43   ` Felipe Contreras
2020-11-25  1:53     ` Junio C Hamano [this message]
2020-11-25 23:48       ` Felipe Contreras
2020-11-26  0:01         ` Junio C Hamano

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=xmqq360ygq2g.fsf@gitster.c.googlers.com \
    --to=gitster@pobox.com \
    --cc=bwilliams.eng@gmail.com \
    --cc=felipe.contreras@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=jacob.keller@gmail.com \
    --cc=peff@peff.net \
    --cc=tkrajina@gmail.com \
    /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).