Skip to content

Commit 40d9632

Browse files
stefanbellergitster
authored andcommitted
setup: add gentle version of resolve_git_dir
This follows a93beda (setup: add gentle version of read_gitfile, 2015-06-09), and assumes the same reasoning. resolve_git_dir is unsuited for speculative calls, so we want to use the gentle version to find out about potential errors. Signed-off-by: Stefan Beller <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 4e59582 commit 40d9632

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

cache.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -509,7 +509,9 @@ extern int is_nonbare_repository_dir(struct strbuf *path);
509509
#define READ_GITFILE_ERR_TOO_LARGE 8
510510
extern const char *read_gitfile_gently(const char *path, int *return_error_code);
511511
#define read_gitfile(path) read_gitfile_gently((path), NULL)
512-
extern const char *resolve_gitdir(const char *suspect);
512+
extern const char *resolve_gitdir_gently(const char *suspect, int *return_error_code);
513+
#define resolve_gitdir(path) resolve_gitdir_gently((path), NULL)
514+
513515
extern void set_git_work_tree(const char *tree);
514516

515517
#define ALTERNATE_DB_ENVIRONMENT "GIT_ALTERNATE_OBJECT_DIRECTORIES"

setup.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1017,11 +1017,11 @@ const char *setup_git_directory(void)
10171017
return setup_git_directory_gently(NULL);
10181018
}
10191019

1020-
const char *resolve_gitdir(const char *suspect)
1020+
const char *resolve_gitdir_gently(const char *suspect, int *return_error_code)
10211021
{
10221022
if (is_git_directory(suspect))
10231023
return suspect;
1024-
return read_gitfile(suspect);
1024+
return read_gitfile_gently(suspect, return_error_code);
10251025
}
10261026

10271027
/* if any standard file descriptor is missing open it to /dev/null */

0 commit comments

Comments
 (0)