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

Re: [PATCH] git-clean: Display more accurate delete messages

From
Zoltan Klinger <zoltan.klinger@gmail.com>
Date
Dec 11, 2012, 12:32 UTC
Message-ID
<CAKJhZwTEykP_w7-02YNUmi8D=X7nD8wSyFBD0_uGE6E760zkNQ@mail.gmail.com>
In-Reply-To
<7v38zecrqc.fsf@alter.siamese.dyndns.org>
Show 5 quoted lines
>> Use git clean --force --force to delete all untracked git repositories
>
> But I am not sure if this is ever sane.  Especially the one that
> removes an embedded repository is suspicious.  "git clean" should
> not ever touch it with or without --superforce or any other command.

My original intention with this patch was to provide more accurate delete messages for the git-clean command when it's used with the current set of command line options. I didn't know that --force --force was so controversial.

The --force --force option has been around since v1.6.4.2. Commit a0f4afbe introduced it. If the consensus is that it is not a sane option to have let's remove it by all means. But I think it should be done in a separate patch '[PATCH] git-clean: Never delete any embedded git repository' or such.

> I do not think trying to remove something that cannot be removed due
> to filesystem permissions is sensible, either. We simply should treat
> such a case a grave error and have the user sort things out, instead
> of blindly attempt to "chmod" them ourselves (which may still fail).

But this is not how git-clean works with or without the --force --force flag. The recursive delete does the right thing: it tries to delete a file or directory, if that fails for whatever reason it will report the error and move on. That's it. No "chmod" or any other hackery at all. The --force --force flag only means "if during recursion you encounter an embedded git directory that is not tracked you are allowed to recurse into it and keep on deleting files and sub-directories as per usual".

Cheers, Zoltan

Previous: Junio C HamanoNext: Soren Brinkmann
Message 10 of 11 in “git-clean: Display more accurate delete messages”
  1. git-clean: Display more accurate delete messagesZoltan Klinger, Dec 6, 2012
  2. Junio C HamanoDec 6, 2012
  3. Soren BrinkmannDec 7, 2012
  4. Zoltan KlingerDec 9, 2012
  5. Junio C HamanoDec 10, 2012
  6. Soren BrinkmannDec 10, 2012
  7. Junio C HamanoDec 10, 2012
  8. Soren BrinkmannDec 10, 2012
  9. Junio C HamanoDec 10, 2012
  10. Zoltan KlingerDec 11, 2012
  11. Soren BrinkmannDec 10, 2012

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.