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

Support git stash show --stat --patch #100

Closed
gibfahn opened this issue Feb 18, 2020 · 3 comments
Closed

Support git stash show --stat --patch #100

gibfahn opened this issue Feb 18, 2020 · 3 comments

Comments

@gibfahn
Copy link

gibfahn commented Feb 18, 2020

Looks like git stash show doesn't get formatted by delta:

image

Using delta 0.0.16 on macOS.

Script to reproduce

export GIT_PAGER='delta --theme=TwoDark'
mkdir tst
cd tst
git init
printf "bar\nbaz\n" >foo_diff
printf "bar\nbaz\n" >foo_stash

git add foo*
git commit -m "Initial Commit"

printf "bat\n" >> foo_stash
git stash
printf "bat\n" >> foo_diff

git diff # Works with delta
git stash show # Doesn't.
@dandavison
Copy link
Owner

Hi @gibfahn I believe you have something like this in your git configuration, right?

[stash]
    showStat = true
    showPatch = true

I say that because, with out-of-the-box git, I'm seeing reasonable behaviour from delta with git stash:

image

However, I definitely agree that what you point out is a bug: i.e. that when the stat and patch outputs are combined, delta fails to recognise the patch:

image

It's fairly clear what the issue is. We peek at the first line to see if we recognise the type of input, see foo_stash | 1 +, don't recognise that, and thereafter never attempt to parse anything. So it seems that one solution would be to keep trying to recognise sections, even after we initially haven't recognised the type of input.

There is an underlying problem here: while I'm OK with most of delta's code, the state machine parser needs to be rewritten!

@gibfahn
Copy link
Author

gibfahn commented Mar 2, 2020

Hi @gibfahn I believe you have something like this in your git configuration, right?

[stash]
showStat = true
showPatch = true

Ahh yeah, I should have thought of that, I tend to forget how much I have in my git config...

So it seems that one solution would be to keep trying to recognise sections, even after we initially haven't recognised the type of input.

Seems reasonable

There is an underlying problem here: while I'm OK with most of delta's code, the state machine parser needs to be rewritten!

That seems like a fairly large challenge 😁 . If I get some time I might take a look, but no guarantees.

@dandavison dandavison changed the title Support git stash show Support git stash show --stat --patch Mar 4, 2020
@dandavison
Copy link
Owner

That seems like a fairly large challenge 😁 . If I get some time I might take a look, but no guarantees.

Yes, tbh it's probably something I'm going to want to have a go at -- I'll feel bad if I leave it in its current state for long and it's making it hard to fix bugs like this.

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

2 participants