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

Re: [PATCH v5] fsck.c: fsck_tree() now use is_dot_or_dotdot().

From
Matthieu Moy <matthieu.moy@grenoble-inp.fr>
Date
Mar 19, 2014, 17:51 UTC
Message-ID
<vpq61nadqkh.fsf@anie.imag.fr>
In-Reply-To
<1395245290-6677-1-git-send-email-mandrei.dinu@gmail.com>
Andrei Dinu <mandrei.dinu@gmail.com> writes:
> ---
>  I try to find other sites that can use id_dot_or_dotdot() function.
This should also have been sent in the same series.
Show 14 quoted lines
> @@ -171,10 +172,12 @@ static int fsck_tree(struct tree *item, int strict, fsck_error error_func)
>  			has_full_path = 1;
>  		if (!*name)
>  			has_empty_name = 1;
> -		if (!strcmp(name, "."))
> -			has_dot = 1;
> -		if (!strcmp(name, ".."))
> -			has_dotdot = 1;
> +		if (is_dot_or_dotdot(name)) {
> +            if (name[1] == '\0')
> +			    has_dot = 1;
> +            else
> +			    has_dotdot = 1;
> +        }

The indentation is wrong. Configure your text editor to show you tabs and spaces differently (e.g. M-x whitespace-mode RET in Emacs). Git uses tabs to indent, and only that.

I find the old code much clearer than the new one. This "name[1] == '\0'" looks weird to test if name is the string ".".

-- 
Matthieu Moy
http://www-verimag.imag.fr/~moy/
Previous: Andrei Dinu
Message 2 of 2 in “fsck.c: fsck_tree() now use is_dot_or_dotdot().”
  1. fsck.c: fsck_tree() now use is_dot_or_dotdot().Andrei Dinu, Mar 19, 2014
  2. Matthieu MoyMar 19, 2014

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.