Subject: Re: [PATCH 2/2] Add support for GIT_ONE_FILESYSTEM

From: Johannes Sixt <[email-masked]>
Date: Wed, 17 Mar 2010 08:09:32 +0100

Lars R. Damerow schrieb:
> @@ -422,6 +429,14 @@ const char *setup_git_directory_gently(int *nongit_ok)
>  			}
>  			die("Not a git repository (or any of the parent directories): %s", DEFAULT_GIT_DIR_ENVIRONMENT);
>  		}
> +		if (one_filesystem) {
> +			if (stat("..", &buf))
> +				die_errno("failed to stat '%s/..'", getcwd(err_cwd, sizeof(err_cwd)-1));

When stat of .. fails, then it is not unlikely that getcwd fails, too.
Then you would report the errno produced by getcwd.

But can't you avoid this getcwd()? The die() call in the context below
uses cwd.

> +			if (buf.st_dev != current_device)
> +				die("Not a git repository (or any parent up to %s/..)\n"
> +					"Stopping at filesystem boundary since GIT_ONE_FILESYSTEM is set.",
> +					getcwd(err_cwd, sizeof(err_cwd)-1));
> +		}
>  		if (chdir(".."))
>  			die_errno("Cannot change to '%s/..'", cwd);
>  	}

-- Hannes