{"thread":{"id":"47101","subject":"[BUG] git clean -d is too greedy","startedAt":"2017-11-02T17:21:48Z","lastAt":"2017-11-02T18:04:47Z","messageCount":2,"participants":["Hermanni Suominen"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"331671","messageId":"d2e823e2-800d-17ba-c9d4-f490cefefd2f@foobar.fi","threadId":"47101","inReplyTo":null,"subject":"[BUG] git clean -d is too greedy","fromName":"Hermanni Suominen","fromEmail":"hermanni@foobar.fi","sentAt":"2017-11-02T17:13:15Z","receivedAt":"2017-11-02T17:21:48Z","isPatch":false,"sender":{"key":"hermanni@foobar.fi","avatar":null},"body":"Hi all,\n\nSince commit 6b1db4310 it is possible to make git clean -d to remove \nnested git repositories if\n\n   1) .gitignore exists in nested repo (either tracked or untracked)\n   2) .gitignore is excluded\n\nRegarding to 2) it doesn't matter if .gitignore is excluded from \n(another) .gitignore or from command-line (but I assume they populate \nsame ignore list so that's just stating the obvious).\n\nTo demonstrate this I can run the following commands:\n\n# git init -q foo && cd foo\n# git init -q bar && cd bar\n# touch .gitignore bar\n# git add bar && git commit -qm asd && cd ..\n# git clean -e .gitignore -dn\nWould remove bar/bar\n\nPre 6b1db4310, and if .gitignore isn't exclued, nested repo is correctly \nskipped:\n\n# git clean -dn\nWould skip repository bar/ \n\n\nIt probably isn't very common use case to exclude .gitignore but \nnevertheless this has been broken for a while, and to make things worse \nit can wipe out lots of uncommitted changes.\n\n-- \nHermanni\n"},{"id":"331681","messageId":"1b6ba313-8d99-8604-1774-0f481eeeabec@foobar.fi","threadId":"47101","inReplyTo":"d2e823e2-800d-17ba-c9d4-f490cefefd2f@foobar.fi","subject":"Re: [BUG] git clean -d is too greedy","fromName":"Hermanni Suominen","fromEmail":"hermanni@foobar.fi","sentAt":"2017-11-02T18:04:40Z","receivedAt":"2017-11-02T18:04:47Z","isPatch":false,"sender":{"key":"hermanni@foobar.fi","avatar":null},"body":"I was a bit trigger happy posting this, after digging a bit more this is \na way more serious than I originally thought.\n\n>    1) .gitignore exists in nested repo (either tracked or untracked)\n>    2) .gitignore is excluded\n\nThis can be any file, including those commonly excluded such as *~.\n\nDemonstrating this in a way that looks a lot more likely use case which \nwill potentially wipe out lots of uncommitted work:\n\n# git init -q foo && cd foo\n# git init -q bar && cd bar\n# touch bar bar~\n# git add bar && git commit -qm asd && cd ..\n# git clean -e \\*~ -dn\nWould remove bar/bar\n\nIf there were more tracked files in nested repo they'd be removed as \nwell as long as there is at least one excluded file in nested repo.\n\n-- \nHermanni\n"}]}