altsem / gitu

A TUI Git client inspired by Magit

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Stash worktree fails with temp commit lingering

altsem opened this issue · comments

With a clean working directory:
gitu -k 'll<enter>uqqzw<enter>'

$ git stash push --staged
error: patch failed: .recent-changelog-entry:1
error: .recent-changelog-entry: patch does not apply
Cannot remove worktree changes
! 'git stash push --staged' exited with code: 1
  1. There shouldn't be any temporarily stashed things left over.
  2. The error should trigger a refresh (now it only appears after pressing g, or some other action).

I failed to catch the error you got, what did I do wrong?:

 danil   fix/stash-worktree  ~/offw/rust/gitu   gitu -k 'll<enter>uqqzw<enter>q'
 danil   fix/stash-worktree {1} U:1  ~/offw/rust/gitu  git stash push --staged
No staged changes
 danil   fix/stash-worktree {1} U:1  ~/offw/rust/gitu  1  git add .
 danil   fix/stash-worktree {1} S:1  ~/offw/rust/gitu  git stash push --staged
Saved working directory and index state WIP on fix/stash-worktree: 36351c0 refactor: make `bindings` module look nicer
 danil   fix/stash-worktree {2}  ~/offw/rust/gitu  

When I simply run gitu -k 'll<enter>uqqzw<enter>' I have no errors and a stashed worktree. One thing which concerns me right now is that why previously stashed index here becomes unstaged 🤔

Ah true, I guess it's for this specific state that I tested.
At some point git stash push --staged creates a stash, but gives this error: "patch does not apply".

This should reproduce it better:
git diff e9b48ec~1 -- .recent-changelog-entry | git apply --cached --reverse
Then

  1. open gitu, and stash the worktree.
  2. Refresh with 'g' and you'll a new stash entry (with the staged changes)