From: "brian m. carlson" <sandals@crustytoothpaste.net>
To: Brandon Williams <bmwill@google.com>
Cc: git@vger.kernel.org, Junio C Hamano <gitster@pobox.com>,
Jeff King <peff@peff.net>
Subject: Re: [PATCH] refspec: allow @ on the left-hand side of refspecs
Date: Mon, 30 Jul 2018 23:14:51 +0000 [thread overview]
Message-ID: <20180730231451.GG945730@genre.crustytoothpaste.net> (raw)
In-Reply-To: <20180730175051.GA154732@google.com>
[-- Attachment #1: Type: text/plain, Size: 1857 bytes --]
On Mon, Jul 30, 2018 at 10:50:51AM -0700, Brandon Williams wrote:
> On 07/29, brian m. carlson wrote:
> > The object ID parsing machinery is aware of "@" as a synonym for "HEAD"
> > and this is documented accordingly in gitrevisions(7). The push
> > documentation describes the source portion of a refspec as "any
> > arbitrary 'SHA-1 expression'"; however, "@" is not allowed on the
> > left-hand side of a refspec, since we attempt to check for it being a
> > valid ref name and fail (since it is not).
> >
> > Teach the refspec machinery about this alias and silently substitute
> > "HEAD" when we see "@". This handles the fact that HEAD is a symref and
> > preserves its special behavior. We need not handle other arbitrary
> > object ID expressions (such as "@^") when pushing because the revision
> > machinery already handles that for us.
>
> So this claims that using "@^" should work despite not accounting for it
> explicitly or am I misreading? Unless I'm mistaken, it looks like we
> don't really support arbitrary rev syntax in refspecs since "HEAD^"
> doesn't work either.
Correct, it does indeed work, at least for me:
genre ok % git push castro HEAD^:refs/heads/temp
Total 0 (delta 0), reused 0 (delta 0)
To https://git.crustytoothpaste.net/git/bmc/git.git
* [new branch] HEAD^ -> temp
genre ok % git push castro @^:refs/heads/temp
Total 0 (delta 0), reused 0 (delta 0)
To https://git.crustytoothpaste.net/git/bmc/git.git
* [new branch] @^ -> temp
Note that in this case, I had to specify a full ref since it didn't
exist on the remote and the left side wasn't a ref name.
Now it doesn't work for fetches, only pushes. Only the left side of a
push refspec can be an arbitrary expression.
--
brian m. carlson: Houston, Texas, US
OpenPGP: https://keybase.io/bk2204
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 867 bytes --]
next prev parent reply other threads:[~2018-07-30 23:15 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-07-29 19:28 [PATCH] refspec: allow @ on the left-hand side of refspecs brian m. carlson
2018-07-30 17:50 ` Brandon Williams
2018-07-30 23:14 ` brian m. carlson [this message]
2018-07-31 16:02 ` Brandon Williams
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=20180730231451.GG945730@genre.crustytoothpaste.net \
--to=sandals@crustytoothpaste.net \
--cc=bmwill@google.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=peff@peff.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).