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

Small "git clean" annoyance

From
Linus Torvalds <torvalds@linux-foundation.org>
Date
Mar 31, 2011, 22:01 UTC
Message-ID
<AANLkTinQscpkRDftLmCrQR+Aq5RacGyurd3kb15y=1FK@mail.gmail.com>

I don't have a patch for this, and I guess it doesn't much matter, but I just found this annoying:

  [torvalds@i5 git]$ mkdir -m 0 tmp
  [torvalds@i5 git]$ git clean -dqfx
  warning: failed to remove tmp/
  [torvalds@i5 git]$ rmdir tmp

and the reason is simply that git gives up if the directory is unreadable and thus cannot be opened.

Which is kind of understandable, but at the same time, if it's empty, a "rmdir()" will just work. So git gave up a bit too soon.

(In case anybody wonders, the reason I had empty unreadable directories around is not because I commonly do "mkdir -m 0", but simply because they got created when I was running a system call fuzzer for testing).

Now, I realize that if the directory isn't empty, and is unreadable, we really should give up (although a better error message about _why_ we failed may be in order) rather than try to chmod it or anything like that. But the simple "try to rmdir it" might be a good addition for the trivial case.

                     Linus
Next: Alex Riesen
Message 1 of 6 in “Small "git clean" annoyance”
  1. Linus TorvaldsMar 31, 2011
  2. Alex RiesenApr 1, 2011
  3. Matthieu MoyApr 1, 2011
  4. Erik Faye-LundApr 1, 2011
  5. Alex RiesenApr 1, 2011
  6. Linus TorvaldsApr 1, 2011

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.