[BUG] git-stash does not handle branch name with slash correctly

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The default (commit) message when creating a stash strips the beginning of
branch names if they contain a slash,
e.g. "WIP on 3.2.x: …" instead of "WIP on stable/3.2.x: …"

From builtin/stash.c (in do_create_stash):

	branch_ref = resolve_ref_unsafe("HEAD", 0, NULL, &flags);
	if (flags & REF_ISSYMREF)
		branch_name = strrchr(branch_ref, '/') + 1;


Whereas git-legacy-stash has this (in create_stash):

	if branch=$(git symbolic-ref -q HEAD)
	then
		branch=${branch#refs/heads/}
	else
		branch='(no branch)'
	fi
	msg=$(printf '%s: %s' "$branch" "$head")

I think it should also strip only "refs/heads/" or use another method that
keeps the branch name intact.

(I have noticed this with a script/function that warns me when trying to
pop a stash to another branch than where it was stashed from initially,
which parses out the (original) branch name from this message.)


[System Info]
git version:
git version 2.33.1

Attachment: OpenPGP_signature
Description: OpenPGP digital signature


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux