From: Junio C Hamano <gitster@pobox.com>
To: Glen Choo <chooglen@google.com>
Cc: git@vger.kernel.org, Kraymer <kraymer@gmail.com>,
Daniel Hahler <git@thequod.de>, Jeff King <peff@peff.net>
Subject: Re: [PATCH] stash: strip "refs/heads/" with skip_prefix
Date: Mon, 24 Jan 2022 23:13:25 -0800 [thread overview]
Message-ID: <xmqq7dao1e5m.fsf@gitster.g> (raw)
In-Reply-To: 20220124205342.41450-1-chooglen@google.com
Glen Choo <chooglen@google.com> writes:
> branch_ref = resolve_ref_unsafe("HEAD", 0, NULL, &flags);
> if (flags & REF_ISSYMREF)
> - branch_name = strrchr(branch_ref, '/') + 1;
> + skip_prefix(branch_ref, "refs/heads/", &branch_name);
The branch_name variable is initialized to a constant string "(no branch)",
so if HEAD is poihnting elsewhere (which you could do manually),
skip_prefix() would fail and leave branch_name intact, which would
give us the desirable outcome, too.
Looking good.
next prev parent reply other threads:[~2022-01-25 7:16 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-11-10 18:55 [BUG] git-stash does not handle branch name with slash correctly Daniel Hahler
2021-11-10 20:53 ` Jeff King
2022-01-24 20:53 ` [PATCH] stash: strip "refs/heads/" with skip_prefix Glen Choo
2022-01-25 7:13 ` Junio C Hamano [this message]
2022-02-24 7:13 ` Glen Choo
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=xmqq7dao1e5m.fsf@gitster.g \
--to=gitster@pobox.com \
--cc=chooglen@google.com \
--cc=git@thequod.de \
--cc=git@vger.kernel.org \
--cc=kraymer@gmail.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.
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).