* bug report: `git stash save -u` deletes directory whose contents are .gitignored
@ 2015-10-13 22:48 lennart spitzner
0 siblings, 0 replies; only message in thread
From: lennart spitzner @ 2015-10-13 22:48 UTC (permalink / raw)
To: git
hi,
- `git stash save -u` deletes a directory, even though the _contents_
of that directory are .gitignored (e.g. "foo/*" in .gitignore).
Detailed reproduction below.
- The behaviour is not present when instead .gitignoring the directory
itself (e.g. "foo"). This does imo not excuse the behaviour of the
described case.
- The behaviour is not present with just `git stash save`.
- The expected behaviour is: Only files listed in `git status` are
stashed away; other things are left untouched. Potential exception:
empty directories.
- I am aware that `git stash save -u` is supposed to have semantics
involving the equivalent of `reset --hard` and `clean -f`. Neither of
those expose the directory-deletion behaviour.
additional comments, not directly relevant to this bug:
- both `git stash save; git stash pop` and `git stash save -u; git
stash pop` should ideally behave as an "identity effect". The latter
might affect the index (i.e. have an effect equivalent to `git reset`
or something in that direction). Any other effect / special cases are
bad interface design imo. If a differing design was chosen on purpose,
i am thankful for pointers on the reasoning.
- no, i luckily did not truely lose files due to the current behaviour.
lennart
----
reproduction:
> git init
Initialized empty Git repository in $SOMEDIR/.git/
> mkdir ignore-contents
> echo "ignore-contents/*" > .gitignore
> git add .gitignore
> git commit -m "initial" > /dev/null
> touch ignore-contents/blah.txt
> touch abc.txt
> git status
On branch master
Untracked files:
(use "git add <file>..." to include in what will be committed)
abc.txt
nothing added to commit but untracked files present (use "git add" to
track)
> ls -1a
.
..
abc.txt
.git
.gitignore
ignore-contents
> git stash save -u
Saved working directory and index state WIP on master: adc468b initial
HEAD is now at adc468b initial
> ls -1a
.
..
.git
.gitignore
> git stash pop &> /dev/null
> ls -1a
.
..
abc.txt
.git
.gitignore
> git --version
git version 2.6.1
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2015-10-13 22:48 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-10-13 22:48 bug report: `git stash save -u` deletes directory whose contents are .gitignored lennart spitzner
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).