All of lore.kernel.org
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: JAYATHEERTH K <jayatheerthkulkarni2005@gmail.com>
Cc: Eric Sunshine <sunshine@sunshineco.com>,
	 smacdonald@kaimaging.com, git@vger.kernel.org
Subject: Re: [PATCH] stash: fix incorrect branch name in stash message
Date: Wed, 14 May 2025 06:28:56 -0700	[thread overview]
Message-ID: <xmqq7c2jcodj.fsf@gitster.g> (raw)
In-Reply-To: <CA+rGoLfpV7XLB01-5evp=qNX3g9-=za9zH33ceBRnzYe3Og=uA@mail.gmail.com> (JAYATHEERTH K.'s message of "Tue, 13 May 2025 06:51:22 +0530")

JAYATHEERTH K <jayatheerthkulkarni2005@gmail.com> writes:

> 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


  reply	other threads:[~2025-05-14 13:28 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-05-12 15:19 [BUG] git stash incorrectly showing submodule branch instead of superproject branch Stuart MacDonald
2025-05-12 16:12 ` Re " K Jayatheerth
2025-05-12 16:26   ` Stuart MacDonald
2025-05-12 16:40     ` [PATCH] stash: fix incorrect branch name in stash message K Jayatheerth
2025-05-12 16:42       ` JAYATHEERTH K
2025-05-12 17:09         ` Stuart MacDonald
2025-05-12 17:49       ` Junio C Hamano
2025-05-12 18:54         ` Eric Sunshine
2025-05-13  1:21           ` JAYATHEERTH K
2025-05-14 13:28             ` Junio C Hamano [this message]
2025-06-08  6:35               ` K Jayatheerth
2025-06-08 13:11                 ` René Scharfe
2025-06-08 14:45                   ` [PATCH v2] " K Jayatheerth
2025-06-08 16:20                     ` Junio C Hamano
2025-06-11  1:32                       ` JAYATHEERTH K
2025-06-11  1:42                       ` [PATCH v3] " K Jayatheerth
2025-06-11 16:00                         ` Junio C Hamano

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=xmqq7c2jcodj.fsf@gitster.g \
    --to=gitster@pobox.com \
    --cc=git@vger.kernel.org \
    --cc=jayatheerthkulkarni2005@gmail.com \
    --cc=smacdonald@kaimaging.com \
    --cc=sunshine@sunshineco.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.