Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@jonathanj
Copy link
Contributor

Currently, the stash detail screen shows "unmerged" for all the files in the stash, which also means there is also no diff being shown for the stash.

It seems like the reason for "unmerged" is that the current implementation does git show <stash_commit> which ends up with diff --cc output, which the diff parser interprets as conflicts.

What I've changed here is to have a separate show_stash screen and to store the stash ref instead of the commit on the ItemData::Stash struct. The new screen runs git stash show -p <stash_ref> instead, which produces a diff that the diff parser is happier about.

I thought it was better to add something explicitly for showing stashes, rather than to try have a way to conditionally modify the diff parser, since it separates the concerns better at the cost of some conciseness in the code. More than happy to take suggestions.

Copy link
Owner

@altsem altsem left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks nice! There's just a linting error it seems:

error: redundant field names in struct initialization
   --> src/items.rs:274:21
    |
274 |                     stash_ref: stash_ref,
    |                     ^^^^^^^^^^^^^^^^^^^^ help: replace it with: `stash_ref`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_field_names
    = note: `-D clippy::redundant-field-names` implied by `-D warnings`
    = help: to override `-D warnings` add `#[allow(clippy::redundant_field_names)]`

error: could not compile `gitu` (lib) due to 1 previous error

💩

I'll merge it in and do a little commit to fix this tiny thing.

@altsem altsem merged commit 5536ea3 into altsem:master Sep 19, 2025
2 of 3 checks passed
@jonathanj
Copy link
Contributor Author

jonathanj commented Sep 19, 2025

Thank you @altsem! Sorry about the linter error, how do I run the linter locally for future reference?

Edit: Checked the CI pipelines and saw it was cargo clippy basically, I'll try remember for future.

@altsem
Copy link
Owner

altsem commented Sep 19, 2025

no worries, I put some stuff in the Makefile, make test should verify everything, and give a little changelog diff at the end. CI does this as well:

run: make test

Perhaps there's a way to incorporate this into Cargo, or some other way to make it more apparent 🤔.

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

Successfully merging this pull request may close these issues.

2 participants