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

Prompt git status wrong after git hook #2519

Open
Tyler-Keith-Thompson opened this issue Dec 26, 2023 · 6 comments
Open

Prompt git status wrong after git hook #2519

Tyler-Keith-Thompson opened this issue Dec 26, 2023 · 6 comments

Comments

@Tyler-Keith-Thompson
Copy link

Hello! Long-time user, first time issue opener here :)

My auto-formatter seems to be messing with my prompt. I've got it set up with a git hook so it formats when I push and what I'm seeing is after the push the prompt gets tricked into thinking there are changes.

The good news is there's an easy fix, if I run git status the prompt gets the up-to-date information and quits showing me there are changes when there aren't.

Screenshot 2023-12-26 at 12 19 29 PM
@romkatv
Copy link
Owner

romkatv commented Jan 4, 2024

It's unlikely that I'll find time to debug this. Sorry.

@PapaniaP
Copy link

Same issue here, albeit I'm a new user and have huge number differences.
image

Not sure if it's the theme or if my .git file is picking up other files?

@romkatv
Copy link
Owner

romkatv commented Jan 14, 2024

If you are experiencing the same issue, then the same "resolution" applies.

However, your comment has no indication that you are indeed experiencing the same issue. It could be #2232 (comment), which has a simple workaround.

@dragonis41
Copy link

@Tyler-Keith-Thompson I don't have this issue with my Git Hooks. Can you share your Git Hook responsible for formatting?
I can be wrong, but I suspect that you don't git add the file again after the formatting, which cause formatted files to not be added to the commit.

image

@Tyler-Keith-Thompson
Copy link
Author

Tyler-Keith-Thompson commented Feb 13, 2024

Nothing quite so simple I’m afraid. I didn’t screenshot it well but I did document that if I simply run git status my prompt becomes aware of what’s up.

to be fair, this hook looks like it’s trying to be awfully clever: https://github.com/hallettj/git-format-staged

@dragonis41
Copy link

Oh, yes, it's not because of what I suspected then.
Oh wow, that's a very big hook !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants