git-2.22.0/repository.c
/*
 * Attempt to resolve and set the provided 'gitdir' for repository 'repo'.
 * Return 0 upon success and a non-zero value upon failure.
 */
Attempt to resolve and set the provided 'gitdir' for repository 'repo'.
Return 0 upon success and a non-zero value upon failure.
Attempt to resolve and set the provided ' gitdir ' for repository ' repo ' . Return 0 upon success and a non - zero value upon failure .
static int repo_init_gitdir(struct repository *repo, const char *gitdir)
{
	int ret = 0;
	int error = 0;
	char *abspath = NULL;
	const char *resolved_gitdir;
	struct set_gitdir_args args = { NULL };
	abspath = real_pathdup(gitdir, 0);
	if (!abspath) {
		ret = -1;
		goto out;
	}
	resolved_gitdir = resolve_gitdir_gently(abspath, &error);
	if (!resolved_gitdir) {
		ret = -1;
		goto out;
	}
	repo_set_gitdir(repo, resolved_gitdir, &args);
out:
	free(abspath);
	return ret;
}
static int repo_init_gitdir ( struct repository * repo , const char * gitdir ) { int ret = 0 ; int error = 0 ; char * abspath = NULL ; const char * resolved_gitdir ; struct set_gitdir_args args = { NULL } ; abspath = real_pathdup ( gitdir , 0 ) ; if ( ! abspath ) { ret = -1 ; goto out ; } resolved_gitdir = resolve_gitdir_gently ( abspath , & error ) ; if ( ! resolved_gitdir ) { ret = -1 ; goto out ; } repo_set_gitdir ( repo , resolved_gitdir , & args ) ; out : free ( abspath ) ; return ret ; }
Attempt to resolve and set the provided 'gitdir' for repository 'repo'.
Attempt to resolve and set the provided ' gitdir ' for repository ' repo ' .
/* 'gitdir' must reference the gitdir directly */