Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

git prompt: resilient check for git stash #6876

Merged
merged 1 commit into from Apr 9, 2020

Conversation

charego
Copy link
Contributor

@charego charego commented Apr 9, 2020

The refs/stash file is deleted by "git gc". The prompt won't display
stash information until another "git stash" command is run.

Using "git rev-parse stash" seems more resilient.

Based the choice on "git stash" test cases:
https://github.com/git/git/blob/master/t/t3903-stash.sh

There is still one edge case that I know of:

  • If there is a branch named "stash", and no actual stashes,
    this will report that there are stashes

@charego
Copy link
Contributor Author

charego commented Apr 9, 2020

The informative git prompt checks for .git/logs/refs/stash instead of .git/refs/stash, and it appears "git gc" doesn't wipe that. If you want I can make that simple change instead.

@krobelus
Copy link
Member

krobelus commented Apr 9, 2020

The informative git prompt checks for .git/logs/refs/stash instead of .git/refs/stash, and it appears "git gc" doesn't wipe that. If you want I can make that simple change instead.

Yeah let's do that.

@krobelus krobelus added the bug Something that's not working as intended label Apr 9, 2020
@krobelus krobelus added this to the fish 3.2.0 milestone Apr 9, 2020
When you run "git gc":

 - .git/refs/stash is deleted
 - .git/logs/refs/stash is kept intact
@charego
Copy link
Contributor Author

charego commented Apr 9, 2020

@krobelus Done, and updated commit message.

@krobelus krobelus merged commit 8029f15 into fish-shell:master Apr 9, 2020
@krobelus
Copy link
Member

krobelus commented Apr 9, 2020

Neat, thanks!

@charego charego deleted the git-prompt-stash branch April 10, 2020 03:01
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jul 9, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something that's not working as intended
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants