git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: git rm bug

From
Todd Zullinger <tmz@pobox.com>
Date
Jun 6, 2018, 20:01 UTC
Message-ID
<20180606200137.GJ3094@zaya.teonanacatl.net>
In-Reply-To
<1528314421.2665575.1398886712.579F37CE@webmail.messagingengine.com>
Thomas Fischer wrote:
Show 7 quoted lines
> 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 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?

-- 
Todd
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
If everything seems to be going well, you have obviously overlooked
something.
Previous: Robert P. J. DayNext: Jeff King
Message 5 of 11 in “git rm bug”
  1. Thomas FischerJun 6, 2018
  2. Robert P. J. DayJun 6, 2018
  3. Thomas FischerJun 6, 2018
  4. Robert P. J. DayJun 6, 2018
  5. Todd ZullingerJun 6, 2018
  6. Jeff KingJun 6, 2018
  7. Timothy RiceJun 6, 2018
  8. Robert P. J. DayJun 6, 2018
  9. Ævar Arnfjörð BjarmasonJun 6, 2018
  10. Ævar Arnfjörð BjarmasonJun 6, 2018
  11. Duy NguyenJun 6, 2018

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.