From: Thomas Fischer <thomasfischer@fastmail.com>
To: "Robert P. J. Day" <rpjday@crashcourse.ca>
Cc: git@vger.kernel.org
Subject: Re: git rm bug
Date: Wed, 06 Jun 2018 14:47:01 -0500 [thread overview]
Message-ID: <1528314421.2665575.1398886712.579F37CE@webmail.messagingengine.com> (raw)
In-Reply-To: <alpine.LFD.2.21.1806061532420.9259@localhost.localdomain>
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.
--
Thomas Fischer
thomasfischer@fastmail.com
On Wed, Jun 6, 2018, at 2:33 PM, Robert P. J. Day wrote:
> On Wed, 6 Jun 2018, Thomas Fischer wrote:
>
> > OVERVIEW
> >
> > "git rm" will remove more files than specified. This is either a bug or undocumented behavior (not in the man pages).
> >
> > SETUP
> >
> > 1. In a git repository, create an empty directory OR a chain of empty directories
> >
> > $ mkdir -p path/to/some/
> >
> > 2. Create a file in the deepest directory and add it to tracking
> >
> > $ touch path/to/some/file
> > $ git add path/to/some/file
> > $ git commit -m 'add path/to/some/file'
> >
> > THE BUG
> >
> > Run 'git rm' on the tracked file.
> >
> > EXPECTED BEHAVIOR
> >
> > $ git rm path/to/some/file
> > rm 'path/to/some/file'
> > $ ls path
> > to/
> > $ ls path/to
> > some/
> >
> > Note that path/, path/to/, and path/to/some/ still exist.
> >
> > ACTUAL BEHAVIOR
> >
> > $ git rm path/to/some/file
> > rm 'path/to/some/file'
> > $ ls path
> > ls: cannot access 'path': No such file or directory
> >
> > The entire chain of empty directories is removed, despite the fact
> > the git outputs only "rm 'path/to/some/file'".
>
> git cannot track empty directories. as that was the *only* content
> in that whole hierarchy, the entire hierarchy had to be deleted.
>
> rday
next prev parent reply other threads:[~2018-06-06 19:47 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 [this message]
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
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=1528314421.2665575.1398886712.579F37CE@webmail.messagingengine.com \
--to=thomasfischer@fastmail.com \
--cc=git@vger.kernel.org \
--cc=rpjday@crashcourse.ca \
/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).