{"thread":{"id":"23414","subject":"Strange case with stash","startedAt":"2010-04-10T18:04:53Z","lastAt":"2010-04-12T21:44:03Z","messageCount":4,"participants":["Khaled al Habache","Charles Bailey"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"139164","messageId":"v2w918f64e01004101104xd4f1b4eciec01d2e87691ee72@mail.gmail.com","threadId":"23414","inReplyTo":null,"subject":"Strange case with stash","fromName":"Khaled al Habache","fromEmail":"khellls@gmail.com","sentAt":"2010-04-10T18:04:53Z","receivedAt":"2010-04-10T18:04:53Z","isPatch":false,"sender":{"key":"khellls@gmail.com","avatar":null},"body":"Hey,\n\nI have faced this scenario, which is best described\nhttp://stackoverflow.com/questions/2613956/strange-git-case, I hope\nyou guys investigate it cause it wasted 5 hours of my time, and I\ndon't wish that happens again to anyone using Git.\n\n-------------------------------\nKhaled alHabache\nSoftware Engineer\n\nBlog:\nhttp://www.khelll.com\n\nRails Magazine:\nhttp://www.railsmagazine.com/team\n\nTwitter:\nhttp://twitter.com/khelll\n\nMobile:\n+963933727070\n+962785257212\n"},{"id":"139177","messageId":"1270923241-14383-1-git-send-email-charles@hashpling.org","threadId":"23414","inReplyTo":"v2w918f64e01004101104xd4f1b4eciec01d2e87691ee72@mail.gmail.com","subject":"[PATCH 1/2] stash bug: stash can lose data in a file removed from the index","fromName":"Charles Bailey","fromEmail":"charles@hashpling.org","sentAt":"2010-04-10T18:14:00Z","receivedAt":"2010-04-10T18:14:00Z","isPatch":true,"sender":{"key":"charles@hashpling.org","avatar":"https://avatars.githubusercontent.com/u/1668475?v=4"},"body":"If a file is removed from the index and then modified in the working\ntree then stash will discard the working tree file with no way to\nrecover the changes.\n\nThis can might be done in one of a number of ways.\n\ngit rm file\nvi file              # edit a new version\ngit stash\n\nor with git mv\n\ngit mv file newfile\nvi file              # make a new file with the old name\ngit stash\n\nSigned-off-by: Charles Bailey <charles@hashpling.org>\n---\n t/t3903-stash.sh |    9 +++++++++\n 1 files changed, 9 insertions(+), 0 deletions(-)\n\ndiff --git a/t/t3903-stash.sh b/t/t3903-stash.sh\nindex 476e5ec..c85bf44 100755\n--- a/t/t3903-stash.sh\n+++ b/t/t3903-stash.sh\n@@ -228,4 +228,13 @@ test_expect_success 'stash --invalid-option' '\n \ttest bar,bar2 = $(cat file),$(cat file2)\n '\n \n+test_expect_failure 'stash git rm' '\n+    git reset --hard &&\n+\tgit rm file &&\n+\techo bar7 > file &&\n+\tgit stash &&\n+\tgit stash apply &&\n+\ttest bar7 = $(cat file)\n+'\n+\n test_done\n-- \n1.7.1.rc0.266.gf3d756\n"},{"id":"139175","messageId":"1270923241-14383-2-git-send-email-charles@hashpling.org","threadId":"23414","inReplyTo":"v2w918f64e01004101104xd4f1b4eciec01d2e87691ee72@mail.gmail.com","subject":"[PATCH 2/2] stash: Don't overwrite files that have gone from the index","fromName":"Charles Bailey","fromEmail":"charles@hashpling.org","sentAt":"2010-04-10T18:14:01Z","receivedAt":"2010-04-10T18:14:01Z","isPatch":true,"sender":{"key":"charles@hashpling.org","avatar":"https://avatars.githubusercontent.com/u/1668475?v=4"},"body":"---\n\nThis patch is deliberately not signed off. It feels kludgy and uses a\nnon-portable xargs invocation.\n\nIt is designed as a starting point for discussion, that is all.\n\n git-stash.sh |    2 ++\n 1 files changed, 2 insertions(+), 0 deletions(-)\n\ndiff --git a/git-stash.sh b/git-stash.sh\nindex 908aab2..9efc544 100755\n--- a/git-stash.sh\n+++ b/git-stash.sh\n@@ -87,6 +87,8 @@ create_stash () {\n \t\t\texport GIT_INDEX_FILE &&\n \t\t\tgit read-tree -m $i_tree &&\n \t\t\tgit add -u &&\n+\t\t\t{ git diff --quiet --diff-filter=D --cached ||\n+\t\t\t\tgit diff -z --name-only --diff-filter=D --cached | xargs -0 git add --ignore-errors; } &&\n \t\t\tgit write-tree &&\n \t\t\trm -f \"$TMP-index\"\n \t\t) ) ||\n-- \n1.7.1.rc0.266.gf3d756\n"},{"id":"139373","messageId":"20100412214403.GA27958@hashpling.org","threadId":"23414","inReplyTo":"1270923241-14383-1-git-send-email-charles@hashpling.org","subject":"Re: [PATCH 1/2] stash bug: stash can lose data in a file removed from the index","fromName":"Charles Bailey","fromEmail":"charles@hashpling.org","sentAt":"2010-04-12T21:44:03Z","receivedAt":"2010-04-12T21:44:03Z","isPatch":true,"sender":{"key":"charles@hashpling.org","avatar":"https://avatars.githubusercontent.com/u/1668475?v=4"},"body":"On Sat, Apr 10, 2010 at 07:14:00PM +0100, Charles Bailey wrote:\n> If a file is removed from the index and then modified in the working\n> tree then stash will discard the working tree file with no way to\n> recover the changes.\n> \n> This can might be done in one of a number of ways.\n> \n> git rm file\n> vi file              # edit a new version\n> git stash\n> \n> or with git mv\n> \n> git mv file newfile\n> vi file              # make a new file with the old name\n> git stash\n\nI just wanted to give this issue a bit more visibility. To me it would\nseem to be fairly important as it's a potential loss of user data with\nno easy recovery.\n\nIf I'm wrong about it, perhaps someone can put me right.\n\nThanks,\n\nCharles.\n"}]}