Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

git prompt: resilient check for git stash#6876

Merged
krobelus merged 1 commit into
fish-shell:masterfish-shell/fish-shell:masterfrom
charego:git-prompt-stashcharego/fish-shell:git-prompt-stashCopy head branch name to clipboard
Apr 9, 2020
Merged

git prompt: resilient check for git stash#6876
krobelus merged 1 commit into
fish-shell:masterfish-shell/fish-shell:masterfrom
charego:git-prompt-stashcharego/fish-shell:git-prompt-stashCopy head branch name to clipboard

Conversation

@charego

@charego charego commented Apr 9, 2020

Copy link
Copy Markdown
Contributor

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
charego force-pushed the git-prompt-stash branch from 96f6751 to b4a6cb7 Compare April 9, 2020 04:20
@charego

charego commented Apr 9, 2020

Copy link
Copy Markdown
Contributor Author

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

krobelus commented Apr 9, 2020

Copy link
Copy Markdown
Contributor

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
charego force-pushed the git-prompt-stash branch from b4a6cb7 to 3f65d75 Compare April 9, 2020 21:18
@charego

charego commented Apr 9, 2020

Copy link
Copy Markdown
Contributor Author

@krobelus Done, and updated commit message.

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

krobelus commented Apr 9, 2020

Copy link
Copy Markdown
Contributor

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.

2 participants

Morty Proxy This is a proxified and sanitized view of the page, visit original site.