git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] stash: fix incorrect branch name in stash message

From
Junio C Hamano <gitster@pobox.com>
Date
May 14, 2025, 13:28 UTC
Message-ID
<xmqq7c2jcodj.fsf@gitster.g>
In-Reply-To
<CA+rGoLfpV7XLB01-5evp=qNX3g9-=za9zH33ceBRnzYe3Og=uA@mail.gmail.com>
JAYATHEERTH K <jayatheerthkulkarni2005@gmail.com> writes:
Show 31 quoted lines
> On Tue, May 13, 2025 at 12:24 AM Eric Sunshine <sunshine@sunshineco.com> wrote:
>>
>> 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
Don't forget to plug the leak, too ;-)
> Thanks for pointing it out
Previous: JAYATHEERTH KNext: K Jayatheerth
Message 10 of 17 in “[BUG] git stash incorrectly showing submodule branch instead of superproject branch”
  1. Stuart MacDonaldMay 12, 2025
  2. Re [BUG] git stash incorrectly showing submodule branch instead of superproject branchK Jayatheerth, May 12, 2025
  3. Stuart MacDonaldMay 12, 2025
  4. stash: fix incorrect branch name in stash messageK Jayatheerth, May 12, 2025
  5. JAYATHEERTH KMay 12, 2025
  6. Stuart MacDonaldMay 12, 2025
  7. Junio C HamanoMay 12, 2025
  8. Eric SunshineMay 12, 2025
  9. JAYATHEERTH KMay 13, 2025
  10. Junio C HamanoMay 14, 2025
  11. stash: fix incorrect branch name in stash messageK Jayatheerth, Jun 8, 2025
  12. René ScharfeJun 8, 2025
  13. stash: fix incorrect branch name in stash messageK Jayatheerth, Jun 8, 2025
  14. Junio C HamanoJun 8, 2025
  15. JAYATHEERTH KJun 11, 2025
  16. stash: fix incorrect branch name in stash messageK Jayatheerth, Jun 11, 2025
  17. Junio C HamanoJun 11, 2025

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.