git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jeff King <peff@peff.net>
To: Todd Zullinger <tmz@pobox.com>
Cc: Thomas Fischer <thomasfischer@fastmail.com>,
	"Robert P. J. Day" <rpjday@crashcourse.ca>,
	git@vger.kernel.org
Subject: Re: git rm bug
Date: Wed, 6 Jun 2018 16:11:44 -0400	[thread overview]
Message-ID: <20180606201144.GA32098@sigill.intra.peff.net> (raw)
In-Reply-To: <20180606200137.GJ3094@zaya.teonanacatl.net>

On Wed, Jun 06, 2018 at 04:01:38PM -0400, Todd Zullinger wrote:

> Thomas Fischer wrote:
> > I agree that the entire chain of empty directories should not be tracked, as git tracks content, not files.
> > 
> > However, when I run 'rm path/to/some/file', I expect path/to/some/ to still exist.
> > 
> > Similarly, when I run 'git rm path/to/some/file', I expect path/to/some/ to exist, *albeit untracked*.
> > 
> > I do NOT expect git to *track* empty directories. But I also do NOT expect it to remove untracked directories.
> 
> It looks like this behavior has been in place for many
> years, since d9b814cc97 ("Add builtin "git rm" command",
> 2006-05-19).  Interestingly, Linus noted in the commit
> message that the removal of leading directories was
> different than when git-rm was a shell script.  And he
> wondered if it might be worth having an option to control
> that behavior.
> 
> I imagine that most users either want the current behavior
> or they rarely run across this and are surprised, given how
> long git rm has worked this way.

It's also consistent with other parts of Git that remove files. E.g.,
"git checkout" to a state that does not have the file will remove the
leading directories (if they're empty, of course).

> It does seem like something which could be noted in the git
> rm docs.  Perhaps you'd care to take a stab at a patch to
> add a note to Documentation/git-rm.txt Thomas?  Maybe a note
> at the end of the DISCUSSION section?

Yeah, agreed.

-Peff

  parent reply	other threads:[~2018-06-06 20:11 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-06-06 19:32 git rm bug Thomas Fischer
2018-06-06 19:33 ` Robert P. J. Day
2018-06-06 19:47   ` Thomas Fischer
2018-06-06 19:51     ` Robert P. J. Day
2018-06-06 20:01     ` Todd Zullinger
2018-06-06 20:10       ` Timothy Rice
2018-06-06 20:20         ` Robert P. J. Day
2018-06-06 22:51         ` Ævar Arnfjörð Bjarmason
2018-06-06 20:11       ` Jeff King [this message]
2018-06-06 22:50     ` Ævar Arnfjörð Bjarmason
2018-06-06 19:54 ` Duy Nguyen

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=20180606201144.GA32098@sigill.intra.peff.net \
    --to=peff@peff.net \
    --cc=git@vger.kernel.org \
    --cc=rpjday@crashcourse.ca \
    --cc=thomasfischer@fastmail.com \
    --cc=tmz@pobox.com \
    /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).