git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* git rm bug
@ 2018-06-06 19:32 Thomas Fischer
  2018-06-06 19:33 ` Robert P. J. Day
  2018-06-06 19:54 ` Duy Nguyen
  0 siblings, 2 replies; 11+ messages in thread
From: Thomas Fischer @ 2018-06-06 19:32 UTC (permalink / raw)
  To: git

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'".

This ONLY occurs when all the directories in the chain are empty after the tracked file has been removed.

This behavior is NOT documented in the man pages.

I propose that 'rmdir' statements are added to 'git rm' output, or that the man pages be updated to reflect this behavior.

Best,
Thomas Fischer

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2018-06-06 22:51 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
2018-06-06 22:50     ` Ævar Arnfjörð Bjarmason
2018-06-06 19:54 ` Duy Nguyen

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).