git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Accidentially deleted directory, bug in git clean -d?
@ 2014-03-10 10:31 Robin Pedersen
  2014-03-10 17:20 ` [PATCH] clean: respect pathspecs with "-d" Jeff King
  0 siblings, 1 reply; 6+ messages in thread
From: Robin Pedersen @ 2014-03-10 10:31 UTC (permalink / raw)
  To: git

I accidentially deleted a directory using git clean. I would think
this is a bug, but I'm not sure. Was using 1.8.1, but upgraded to
1.9.0 just to see if it was still reproducable, and it was.

Here's a minimal way to reproduce:

$ git init
$ mkdir foo foobar
$ git clean -df foobar
Removing foo/
Removing foobar/
$ ls
$

I expected only "foobar" to be deleted, but "foo" was also deleted.

The same thing happens in the opposite case:

$ git init
$ mkdir foo foobar
$ git clean -df foo
Removing foo/
Removing foobar/
$ ls
$

However, it only happens when there is a common prefix in the names:

$ git init
$ mkdir foo bar
$ git clean -df foo
Removing foo/
$ ls
bar
$

In this case, "bar" was not deleted.

-- 
Best regards,

Robin Pedersen
Software Engineer

SnapTV AS
Jordmor Magdalenes vei 17
N-9519 Kviby.
Norway

robinp@snap.tv
http://www.snap.tv

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2014-03-10 20:37 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-03-10 10:31 Accidentially deleted directory, bug in git clean -d? Robin Pedersen
2014-03-10 17:20 ` [PATCH] clean: respect pathspecs with "-d" Jeff King
2014-03-10 17:22   ` Jeff King
2014-03-10 20:02     ` Simon Ruderich
2014-03-10 20:37       ` Jeff King
2014-03-10 17:24   ` [PATCH] clean: simplify dir/not-dir logic Jeff King

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).