From: sivno.20.toranaga-san@spamgourmet.com
To: git@vger.kernel.org
Subject: Git stash behavior
Date: Wed, 12 Aug 2015 16:57:25 +0200 [thread overview]
Message-ID: <55CB5ED5.5020908@gmx.de> (raw)
Hello all,
I am using git stashes to ensure that my source builds and tests
correctly. My general work flow is this: Before committing I create a
stash and clean everything:
git stash save -q --keep-index --include-untracked
Then I perform some tests (mvn compile test), after that I restore
everything:
git stash pop -q
I am using this from a pre-commit hook so I really need this to work
reliably. The problem is that I think that it really doesn't. I created
a small gist to show the problem here:
https://gist.github.com/x2b/3cc3d8aa8979561de4b5
There are actually multiple problems here:
1.
If an untracked file already exists then git refuses to pop the stash.
This is certainly the desired behavior in most cases. However, I would
appreciate a "--force" option to override it.
2.
As you can see the content of the "untracked" file in the gist is the
same in the stash and the working directory. Is it really necessary to
abort the operation in this case??
3.
The most severe problem is that after unsuccessfully trying to pop the
stash the "first_untracked" file is restored while the "untracked" file
is not. The stash is *partially* applied to the working directory. It
seems like git restores some files before giving up after encountering
the first file which can't be restored. I think this behavior is not
generally what is expected. Git should either fail and leave the working
directory as-is or succeed and change the directory's content.
Since there is no "--force" option (see 1.) it is necessary to remove
the already restored untracked files by hand before attempting to pop
the stash once more (this is really inconvenient to me).
While these are not technically bugs I would appreciate it if you could
address these issues all the same.
x2b
next reply other threads:[~2015-08-12 14:57 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-08-12 14:57 sivno.20.toranaga-san [this message]
2015-08-17 11:00 ` Git stash behavior Ed Avis
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=55CB5ED5.5020908@gmx.de \
--to=sivno.20.toranaga-san@spamgourmet.com \
--cc=git@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).