Re: [PATCH 13/16] init: allow alternate backends to be set for new repos
- From
Jeff King <peff@peff.net>
- Date
- Dec 10, 2015, 18:02 UTC
- Message-ID
- <20151210180213.GA27152@sigill.intra.peff.net>
- In-Reply-To
- <1449102921-7707-14-git-send-email-dturner@twopensource.com>
On Wed, Dec 02, 2015 at 07:35:18PM -0500, David Turner wrote:
Show 17 quoted lines
> @@ -510,9 +511,36 @@ int validate_headref(const char *path)
> unsigned char sha1[20];
> int fd;
> ssize_t len;
> + struct refdb_config_data refdb_data = {NULL, NULL};
> +
> + if (lstat(path, &st) < 0) {
> + int backend_type_set;
> + struct strbuf config_path = STRBUF_INIT;
> + if (path) {
> + char *pathdup = xstrdup(path);
> + char *git_dir = dirname(pathdup);
> + strbuf_addf(&config_path, "%s/%s", git_dir, "config");
> + free(pathdup);
> + } else {
> + strbuf_addstr(&config_path, "config");
> + }Can we ever follow this "else" branch? It would mean feeding NULL to lstat.
-Peff