From: Eric Sunshine Date: Mon, 12 May 2025 18:54:41 GMT Subject: Re: [PATCH] stash: fix incorrect branch name in stash message Message-ID: In-Reply-To: On Mon, May 12, 2025 at 1:50 PM Junio C Hamano wrote: > K Jayatheerth 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?