git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* git stash can recursively delete a directory with no warning
@ 2016-11-16 20:19 Russell Yanofsky
  0 siblings, 0 replies; only message in thread
From: Russell Yanofsky @ 2016-11-16 20:19 UTC (permalink / raw)
  To: git

Using git 2.10.1, I recently lost the contents of an entire directory
by running a "git stash" command. I don't know if this known behavior,
but it seems pretty dangerous. To trigger the bug, all you have to do
is check out a repository containing a symlink, delete the symlink,
and then create a directory with files at the path where the deleted
symlink was. After this, running "git stash" will recursively delete
the directory, leaving no way to recover the data.

Here are minimal steps to reproduce:

mkdir test-repo
cd test-repo
git init
ln -s location symlink
git add symlink
git commit -m'add symlink'
rm symlink
mkdir symlink
echo important-data > symlink/important-data
git stash # recursively deletes entire contents of "symlink" directory

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2016-11-16 20:19 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-11-16 20:19 git stash can recursively delete a directory with no warning Russell Yanofsky

Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).