From: Junio C Hamano <gitster@pobox.com>
To: "brian m. carlson" <sandals@crustytoothpaste.net>,
Jeff King <peff@peff.net>
Cc: Mark Florian <mflorian@gitlab.com>, git@vger.kernel.org
Subject: Re: `@` alias for `HEAD` not working in `git push -u origin @`
Date: Wed, 31 Jul 2019 09:10:47 -0700 [thread overview]
Message-ID: <xmqqsgqmqj5k.fsf@gitster-ct.c.googlers.com> (raw)
In-Reply-To: <20190731055832.GA18039@sigill.intra.peff.net> (Jeff King's message of "Wed, 31 Jul 2019 01:58:33 -0400")
Jeff King <peff@peff.net> writes:
> On Wed, Jul 10, 2019 at 11:39:37PM +0000, brian m. carlson wrote:
>
>> This is a bug. If the destination side of a refspec is omitted, and the
>> source side resolves to a ref starting with "refs/heads/" or
>> "refs/tags/" (which I expect it does here), then that ref is used as the
>> destination.
>>
>> I submitted a patch at [0], but it was decided not to pick it up. If
>> Junio and the list decide that it's wanted, I'm happy to resend or
>> revise and resend.
>>
>> [0] https://public-inbox.org/git/20180729192803.1047050-1-sandals@crustytoothpaste.net/
>
> I see I was cc'd on that original, but I don't remember ever reading it.
> It seems like a sane enough idea to me.
I see I was also on the cc list; I am not sure what I thought about
the patch (i.e. implementation, not the desire to use '@' in the
context in place for "HEAD") back then.
Now I read it with everything I thought forgotten, I see two
potential issues:
- Any error message downstream will mention "HEAD" and there won't
be a trace of it originally being an "@" sign. It may not be a
problem, especially for those who _KNOW_ that they should be
typing HEAD but can type "@" instead, but I am not sure what to
do those who do not know much about "HEAD" and start from "@" (by
the way, it is one reason why I do not like encouraging "@",
especially in introductory text).
- The code should update llen to 4; right now the remainder of the
function does not use the variable in a way that the discrepancy
of replacing "@" with "HEAD" without updating llen matters, but
relying on the shape of the code that happens to exist right now
is a bad code hygiene.
Other than that, the patch looks sensible to me.
> Although I did notice that you mentioned there:
>
>> I probably type "git push upstream HEAD" from five to thirty times a
>> day
>
> I find I do that rarely, because I have:
>
> [push]
> default = current
>
> and in a triangular workflow, I have:
>
> [remote]
> pushDefault = upstream
>
> So "git push" without arguments typically does the same thing for me.
>
> Not an argument against your patch, but just something you might find
> useful.
That's a helpful tangent. Thanks.
prev parent reply other threads:[~2019-07-31 16:10 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-07-10 5:06 `@` alias for `HEAD` not working in `git push -u origin @` Mark Florian
2019-07-10 23:39 ` brian m. carlson
2019-07-11 9:46 ` Johannes Schindelin
2019-07-11 14:48 ` brian m. carlson
2019-07-12 10:29 ` Johannes Schindelin
2019-07-31 5:58 ` Jeff King
2019-07-31 16:10 ` 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
List information: http://vger.kernel.org/majordomo-info.html
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=xmqqsgqmqj5k.fsf@gitster-ct.c.googlers.com \
--to=gitster@pobox.com \
--cc=git@vger.kernel.org \
--cc=mflorian@gitlab.com \
--cc=peff@peff.net \
--cc=sandals@crustytoothpaste.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.
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.git
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 read-only IMAP folder(s) and NNTP newsgroup(s).