{"thread":{"id":"53452","subject":"stash pop results in conflict after stash --keep-index with the same file in index and working directory","startedAt":"2020-05-12T11:46:19Z","lastAt":"2020-05-12T11:46:19Z","messageCount":1,"participants":["Jakub Dąbek"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"397595","messageId":"CAAop36+Qg1vEsOoJehNBDDAvxYQO4cba9g2j9-sKbrxsuoJk5A@mail.gmail.com","threadId":"53452","inReplyTo":null,"subject":"stash pop results in conflict after stash --keep-index with the same file in index and working directory","fromName":"Jakub Dąbek","fromEmail":"jakub.dabek@gmail.com","sentAt":"2020-05-12T11:45:54Z","receivedAt":"2020-05-12T11:46:19Z","isPatch":false,"sender":{"key":"jakub.dabek@gmail.com","avatar":null},"body":"I was trying to write a pre-commit hook for testing using stash to\nkeep irrelevant changes, but pop couldn't apply changes automatically\nwhen the same file with different changes was in index and working\ndirectory at the same time.\n\nReproduction:\n\n  mkdir git-stash-test && cd git-stash-test\n  git init\n  echo foo > foo.txt\n  git add . && git commit -m 'init'\n  echo foo2 > foo.txt\n  git add foo.txt\n  echo foo3 > foo.txt\n  git status # (*)\n  git stash push --keep-index\n  git status\n  # do testing\n  git stash pop\n\nExpected result: same state as before push (*); actual result:\n\n  Auto-merging foo.txt\n  CONFLICT (content): Merge conflict in foo.txt\n  The stash entry is kept in case you need it again.\n\n--index option doesn't help when used with pop.\n\nMy assumption is that pop should be the reverse of push when nothing\nhas changed in between, but I don't know if this is a bug or\nunexpected behaviour. (git version 2.26.2)\n"}]}