frostming / legit

Git for Humans, Inspired by GitHub for Mac™.
https://frostming.github.io/legit
BSD 3-Clause "New" or "Revised" License
5.71k stars 217 forks source link

Switch fails to unstash for branch names with a forward slash #267

Closed kevinbosak closed 1 year ago

kevinbosak commented 4 years ago

This has caused some issues for me in the past, and could cause you to lose work. To recreate:

I've been able to recreate on prior versions, as well as 1.2.0.post0.

kevinbosak commented 4 years ago

This appears to be due to legit relying on the default git stash message's prefix ("On <branchname") which seems to truncate the branch name at the slash. It may be better if legit also adds the branch name in the message, and checks that when changing branches. When I have time, I'll work this up and perhaps create a PR.

weakish commented 1 year ago

I tried to reproduce this bug in GitHub Codespace (Ubuntu, git 2.42.0) but I failed (stashed edits restored).

This appears to be due to legit relying on the default git stash message's prefix ("On <branchname") which seems to truncate the branch name at the slash.

The branch name is not truncated under git 2.42.0:

Saved working directory and index state On tasks/task-123: Legit: stashing before switching branches.

Close it for now. If anyone can reproduce this bug, please comment (please provide legit version, git version, and os info).