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

Stash apply requires clean index #5501

Open
wmertens opened this issue Apr 29, 2020 · 0 comments · May be fixed by #5789
Open

Stash apply requires clean index #5501

wmertens opened this issue Apr 29, 2020 · 0 comments · May be fixed by #5789

Comments

@wmertens
Copy link

Reproduction steps

try to apply a stash when index is dirty. This is specifically prevented by

if ((error = ensure_clean_index(repo, repo_index)) < 0)
which was added in #3259

However, git allows this:

3066 $ git init
Initialized empty Git repository in /home/wmertens/testgit/.git/
3067 $ touch bar
3071 $ git commit  -a -m 'hi'
[master (root-commit) b37d552] hi
 1 file changed, 0 insertions(+), 0 deletions(-)
 create mode 100644 bar
3082 $ echo hi  > foo
3084 $ git add foo
3088 $ git stash
Saved working directory and index state WIP on master: b37d552 hi
3089 $ echo boom  > foo
3091 $ git add foo
3093 $ git stash apply
CONFLICT (add/add): Merge conflict in foo
Auto-merging foo
3094 $ git status
On branch master
Unmerged paths:
  (use "git restore --staged <file>..." to unstage)
  (use "git add <file>..." to mark resolution)
        both added:      foo
3095 $ cat foo
<<<<<<< Updated upstream
boom
=======
hi
>>>>>>> Stashed changes

IMHO libgit should behave like git, and the clean check should not be done.

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 a pull request may close this issue.

1 participant