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

Re: [PATCH v9 1/9] git-clean: refactor git-clean into two phases

From
Jiang Xin <worldhello.net@gmail.com>
Date
May 15, 2013, 15:07 UTC
Message-ID
<CANYiYbF+JLqyB19gHxcC+-ysM=hbMZMve=4JNoiu15B=jaUS9g@mail.gmail.com>
In-Reply-To
<7vbo8ce14u.fsf@alter.siamese.dyndns.org>
2013/5/15 Junio C Hamano <gitster@pobox.com>:
Show 33 quoted lines
> Jiang Xin <worldhello.net@gmail.com> writes:
>
>> 2013/5/15 Junio C Hamano <gitster@pobox.com>:
>>>> @@ -242,11 +287,6 @@ int cmd_clean(int argc, const char **argv, const char *prefix)
>>>>                               continue; /* Yup, this one exists unmerged */
>>>>               }
>>>>
>>>> -             /*
>>>> -              * we might have removed this as part of earlier
>>>> -              * recursive directory removal, so lstat() here could
>>>> -              * fail with ENOENT.
>>>> -              */
>>>>               if (lstat(ent->name, &st))
>>>>                       continue;
>>>
>>> I am guessing that the reason why you removed the comment is because
>>> during this phase there is no way we "might have removed".  But if
>>> that is the case, does it still make sense to run lstat() and ignore
>>> errors from the call?
>>>
>>
>> Run lstat() here is necessary, because we need to check whether
>> ent->name points to a file or a directory. If ent points to a directory,
>> only add to del_list when user provides '-x' option to git-clean.
>
> Sorry, but that was not the question; we can see st is used
> immediately below so somebody needs to fill it.
>
> I was pointing out that the "lstat() is expected to fail with ENOENT
> but it is not an error worth reporting" justification the original
> code had to silently ignore an error, because you no longer remove
> anything immediately in this part of the code.  Is "if () continue"
> still valid thing to do here, not "if () die()"?
I'm clear, it could be:
                if (lstat(ent->name, &st))
                        die_errno("Cannot lstat '%s'", ent->name);
-- 
Jiang Xin
Previous: Junio C HamanoNext: Jiang Xin
Message 6 of 19 in “interactive git-clean”
  1. 0/9 interactive git-cleanJiang Xin, May 14, 2013
  2. 1/9 git-clean: refactor git-clean into two phasesJiang Xin, May 14, 2013
  3. Junio C HamanoMay 14, 2013
  4. Jiang XinMay 15, 2013
  5. Junio C HamanoMay 15, 2013
  6. Jiang XinMay 15, 2013
  7. 0/2 refactor relative_path in path.cJiang Xin, May 15, 2013
  8. 1/2 path.c: refactor relative_path(), not only strip prefixJiang Xin, May 15, 2013
  9. 2/2 quote.c: remove path_relative, use relative_path insteadJiang Xin, May 15, 2013
  10. Junio C HamanoMay 15, 2013
  11. 2/9 git-clean: add support for -i/--interactiveJiang Xin, May 14, 2013
  12. 3/9 git-clean: show items of del_list in columnsJiang Xin, May 14, 2013
  13. 4/9 git-clean: add colors to interactive git-cleanJiang Xin, May 14, 2013
  14. 5/9 git-clean: use a git-add-interactive compatible UIJiang Xin, May 14, 2013
  15. 6/9 git-clean: add filter by pattern interactive actionJiang Xin, May 14, 2013
  16. 7/9 git-clean: add select by numbers interactive actionJiang Xin, May 14, 2013
  17. 8/9 git-clean: add ask each interactive actionJiang Xin, May 14, 2013
  18. 9/9 git-clean: add documentation for interactive git-cleanJiang Xin, May 14, 2013
  19. Junio C HamanoMay 14, 2013

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.