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

Re: BUG: git clean -d cannot remove files from read-only directories

From
AMAdam Milazzo <adam.milazzo@microsoft.com>
Date
Feb 20, 2020, 18:55 UTC
Message-ID
<BL0PR2101MB108917C204868FA653C2948680130@BL0PR2101MB1089.namprd21.prod.outlook.com>
> It is how UNIX-like filesystem works, isn't it?
Sure, but it doesn't have to be how "git clean -d" works. In particular, "git clean -ffd" could be more forceful, or there could be another option or a third level of force beyond the current two levels.
It really comes back to this question: "How can I avoid the failure, given that I am running 'git clean' from a script and not interactively?" The only answer I could find that's not unreasonable is to parse the text output of 'git status -s' to find the untracked directories and then run 'chmod -R u+w' on each of those directories before running 'git clean -d'." I can do that, but I still think a "force" (or other) flag that really forces the cleanup would be preferable, especially given that this isn't a completely idiosyncratic scenario but one that will happen more and more as go modules are adopted (unless go is changed to stop putting them in read-only directories).
Next: Elijah Newren
Message 1 of 8 in “Re: BUG: git clean -d cannot remove files from read-only directories”
  1. Adam MilazzoFeb 20, 2020
  2. Elijah NewrenFeb 20, 2020
  3. Adam MilazzoFeb 20, 2020
  4. Junio C HamanoFeb 20, 2020
  5. Adam MilazzoFeb 20, 2020
  6. Elijah NewrenFeb 21, 2020
  7. Elijah NewrenFeb 20, 2020
  8. Junio C HamanoFeb 21, 2020

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.