From: Junio C Hamano <gitster@pobox.com>
To: Alexandre Garnier <zigarn@gmail.com>
Cc: git@vger.kernel.org
Subject: Re: Revision ref '@{push}' not resolved as documented
Date: Mon, 03 Apr 2023 09:51:41 -0700 [thread overview]
Message-ID: <xmqqh6tw7vtu.fsf@gitster.g> (raw)
In-Reply-To: <CAFFOgCUs9d6wJDf3p-+8UkzXRSymCgBctGt+rP+k0CzZPp2LJw@mail.gmail.com> (Alexandre Garnier's message of "Sun, 2 Apr 2023 17:16:18 +0200")
Alexandre Garnier <zigarn@gmail.com> writes:
> # Push is done with the expected remote, and only then the ref can be resolved
> $ git push
> Total 0 (delta 0), reused 0 (delta 0), pack-reused 0
> To ../myfork.git
> * [new branch] mybranch -> mybranch
> $ git rev-parse --symbolic-full-name @{push}
> refs/remotes/myfork/mybranch
This one is expected.
I think the root cause of this confusion is that the "rev-parse"
command, even with "--symbolic" or "--symbolic-full-name", is still
about answering a question about an existing object name. If
"rev-parse X" fails because X does not spell a valid object name,
"rev-parse --symbolic-full-name X" is designed to fail the same way.
I am not sure how involved the implementation to change the above
design to be offhand. The general flow of rev-parse is to feed an
end-user supplied string to the object-name layer and ask it to be
turned into an object name, and "--symbolic-full" must be stopping
that flow after the original string is canonicalized (e.g. 'master'
is turned into 'refs/heads/master') but before it is turned into an
object name, in order to be able to return 'refs/heads/master'. I
would not be surprised if it wasn't to hard to special case the
"--symbolic" request to yield an unborn branch name like you
expected, but it would change the semantics and breaks backward
compatibility, so care must be taken if anybody wants to pursue
this.
Thanks.
prev parent reply other threads:[~2023-04-03 16:51 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-04-02 15:16 Revision ref '@{push}' not resolved as documented Alexandre Garnier
2023-04-02 18:41 ` Felipe Contreras
2023-04-03 16: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=xmqqh6tw7vtu.fsf@gitster.g \
--to=gitster@pobox.com \
--cc=git@vger.kernel.org \
--cc=zigarn@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).