Re: [PATCH] stash: fix incorrect branch name in stash message
- From
JAYATHEERTH K <jayatheerthkulkarni2005@gmail.com>
- Date
- May 13, 2025, 01:21 UTC
- Message-ID
- <CA+rGoLfpV7XLB01-5evp=qNX3g9-=za9zH33ceBRnzYe3Og=uA@mail.gmail.com>
- In-Reply-To
- <CAPig+cSbwGdhq66tSk_A5oNGXqpbqFA=ZO5GS1E-ENb+_rY70A@mail.gmail.com>
On Tue, May 13, 2025 at 12:24 AM Eric Sunshine <sunshine@sunshineco.com> wrote:
Show 25 quoted lines
>
> On Mon, May 12, 2025 at 1:50 PM Junio C Hamano <gitster@pobox.com> wrote:
> > K Jayatheerth <jayatheerthkulkarni2005@gmail.com> writes:
> > > @@ -1404,11 +1405,20 @@ static int do_create_stash(const struct pathspec *ps, struct strbuf *stash_msg_b
> > > + if (flags & REF_ISSYMREF) {
> > > + const char *tmp = NULL;
> > > + if (skip_prefix(branch_ref, "refs/heads/", &tmp))
> > > + branch_name_buf = xstrdup(tmp);
> > > + }
> > > + if (branch_name_buf)
> > > + branch_name = branch_name_buf;
> > > + else
> > > + branch_name = "(no branch)";
> > > +
> > > + head_short_sha1 = repo_find_unique_abbrev(the_repository,
> > > + &head_commit->object.oid,
> > > + DEFAULT_ABBREV);
> > > strbuf_addf(&msg, "%s: %s ", branch_name, head_short_sha1);
> > > pp_commit_easy(CMIT_FMT_ONELINE, head_commit, &msg);
> >
> > Funny indentation, and branch_name_buf needs to be free'ed after use
> > but other than that, nice digging!
>
> This change should also be accompanied by a new test to verify the
> fixed behavior, right?I will be writing a patch series after checking CI and include tests, the only reason I sent this patch was if the bug reporter needed an immediate fix. Will send a new patch with test case and improved indentation
Thanks for pointing it out
-Jayatheerth