git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Hermanni Suominen <hermanni@foobar.fi>
To: git@vger.kernel.org
Subject: [BUG] git clean -d is too greedy
Date: Thu, 2 Nov 2017 17:13:15 +0000	[thread overview]
Message-ID: <d2e823e2-800d-17ba-c9d4-f490cefefd2f@foobar.fi> (raw)

Hi all,

Since commit 6b1db4310 it is possible to make git clean -d to remove 
nested git repositories if

   1) .gitignore exists in nested repo (either tracked or untracked)
   2) .gitignore is excluded

Regarding to 2) it doesn't matter if .gitignore is excluded from 
(another) .gitignore or from command-line (but I assume they populate 
same ignore list so that's just stating the obvious).

To demonstrate this I can run the following commands:

# git init -q foo && cd foo
# git init -q bar && cd bar
# touch .gitignore bar
# git add bar && git commit -qm asd && cd ..
# git clean -e .gitignore -dn
Would remove bar/bar

Pre 6b1db4310, and if .gitignore isn't exclued, nested repo is correctly 
skipped:

# git clean -dn
Would skip repository bar/ 


It probably isn't very common use case to exclude .gitignore but 
nevertheless this has been broken for a while, and to make things worse 
it can wipe out lots of uncommitted changes.

-- 
Hermanni

             reply	other threads:[~2017-11-02 17:21 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-02 17:13 Hermanni Suominen [this message]
2017-11-02 18:04 ` [BUG] git clean -d is too greedy Hermanni Suominen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=d2e823e2-800d-17ba-c9d4-f490cefefd2f@foobar.fi \
    --to=hermanni@foobar.fi \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).