* [BUG] Bug in git stash
@ 2013-01-14 9:18 Nikolay Frantsev
2013-01-14 11:45 ` Johannes Sixt
0 siblings, 1 reply; 2+ messages in thread
From: Nikolay Frantsev @ 2013-01-14 9:18 UTC (permalink / raw)
To: git
[-- Attachment #1: Type: text/plain, Size: 2099 bytes --]
Hi, I found very strange bug in git stash. Testcase attached to this mail.
1. I have a test repo with two modified files and one new file with
content witch added to commit (see repo in attached file):
nikolay@localhost:~/Desktop/git-stash_bug/bug$ git status
# On branch master
# Changes to be committed:
# (use "git reset HEAD <file>..." to unstage)
#
# new file: 3
#
# Changes not staged for commit:
# (use "git add <file>..." to update what will be committed)
# (use "git checkout -- <file>..." to discard changes in working directory)
#
# modified: 1
# modified: 2
#
2. Stashing two modified files into stash named one:
nikolay@localhost:~/Desktop/git-stash_bug/bug$ git stash save --keep-index one
Saved working directory and index state On master: one
HEAD is now at 7e495f9 files added
3. Checking status, files stashed successfully:
nikolay@localhost:~/Desktop/git-stash_bug/bug$ git status
# On branch master
# Changes to be committed:
# (use "git reset HEAD <file>..." to unstage)
#
# new file: 3
#
4. Stashing one added to commit file into stash named zero:
nikolay@localhost:~/Desktop/git-stash_bug/bug$ git stash save zero
Saved working directory and index state On master: zero
HEAD is now at 7e495f9 files added
5. Checking status, files stashed successfully:
nikolay@localhost:~/Desktop/git-stash_bug/bug$ git status
# On branch master
nothing to commit, working directory clean
6. Trying to unstash first stashed changes (on step 2), there a bug:
nikolay@localhost:~/Desktop/git-stash_bug/bug$ git stash pop stash@{1}
# On branch master
# Changes to be committed:
# (use "git reset HEAD <file>..." to unstage)
#
# new file: 3
#
# Changes not staged for commit:
# (use "git add <file>..." to update what will be committed)
# (use "git checkout -- <file>..." to discard changes in working directory)
#
# modified: 1
# modified: 2
#
Dropped stash@{1} (7926ab7285753c179a368a3a7e8ebfb0f39d0437)
Why there a new empty file named 3?
I'm using git 1.8.1, same problem confirmed on git 1.7.12.4.
--
Nikolay Frantsev
Homepage: http://frantsev.ru/
[-- Attachment #2: git-stash_bug.zip --]
[-- Type: application/zip, Size: 13186 bytes --]
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [BUG] Bug in git stash
2013-01-14 9:18 [BUG] Bug in git stash Nikolay Frantsev
@ 2013-01-14 11:45 ` Johannes Sixt
0 siblings, 0 replies; 2+ messages in thread
From: Johannes Sixt @ 2013-01-14 11:45 UTC (permalink / raw)
To: Nikolay Frantsev; +Cc: git
Am 1/14/2013 10:18, schrieb Nikolay Frantsev:
> nikolay@localhost:~/Desktop/git-stash_bug/bug$ git status
> # On branch master
> # Changes to be committed:
> # (use "git reset HEAD <file>..." to unstage)
> #
> # new file: 3
> #
> # Changes not staged for commit:
> # (use "git add <file>..." to update what will be committed)
> # (use "git checkout -- <file>..." to discard changes in working directory)
> #
> # modified: 1
> # modified: 2
> #
> nikolay@localhost:~/Desktop/git-stash_bug/bug$ git stash save --keep-index one
> Saved working directory and index state On master: one
> HEAD is now at 7e495f9 files added
...
> nikolay@localhost:~/Desktop/git-stash_bug/bug$ git stash pop stash@{1}
> # On branch master
> # Changes to be committed:
> # (use "git reset HEAD <file>..." to unstage)
> #
> # new file: 3
> #
> # Changes not staged for commit:
> # (use "git add <file>..." to update what will be committed)
> # (use "git checkout -- <file>..." to discard changes in working directory)
> #
> # modified: 1
> # modified: 2
> #
> Dropped stash@{1} (7926ab7285753c179a368a3a7e8ebfb0f39d0437)
>
> Why there a new empty file named 3?
It is by design. --keep-index only achieves that your staged changes are
not reverted, but nevertheless all changes are stashed away. Therefore,
when you later apply the stash, you also get back the modified index.
-- Hannes
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2013-01-14 11:46 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-01-14 9:18 [BUG] Bug in git stash Nikolay Frantsev
2013-01-14 11:45 ` Johannes Sixt
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).