Accidentially deleted directory, bug in git clean -d?
- From
- Robin Pedersen <robinp@snap.tv>
- Date
- Mar 10, 2014, 10:31 UTC
- Message-ID
- <CABN9-fcpyDogh45WPwuS1qgkE1jLuOAtejuW=fGCKNNyNm3DEQ@mail.gmail.com>
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