summaryrefslogtreecommitdiff
path: root/cache.h
diff options
context:
space:
mode:
authorErik Elfström <erik.elfstrom@gmail.com>2015-06-09 18:24:35 (GMT)
committerJunio C Hamano <gitster@pobox.com>2015-06-09 19:29:22 (GMT)
commita93bedada88dc15b0143708e1cb87c8fe9b9c705 (patch)
treeb9e64e6c52f9c745a6718a8d8e74d45035213cb1 /cache.h
parent7974889a053574e449b55ca543a486e38e74864f (diff)
downloadgit-a93bedada88dc15b0143708e1cb87c8fe9b9c705.zip
git-a93bedada88dc15b0143708e1cb87c8fe9b9c705.tar.gz
git-a93bedada88dc15b0143708e1cb87c8fe9b9c705.tar.bz2
setup: add gentle version of read_gitfile
read_gitfile will die on most error cases. This makes it unsuitable for speculative calls. Extract the core logic and provide a gentle version that returns NULL on failure. The first usecase of the new gentle version will be to probe for submodules during git clean. Helped-by: Junio C Hamano <gitster@pobox.com> Helped-by: Jeff King <peff@peff.net> Signed-off-by: Erik Elfström <erik.elfstrom@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'cache.h')
-rw-r--r--cache.h11
1 files changed, 10 insertions, 1 deletions
diff --git a/cache.h b/cache.h
index 571c98f..25578cb 100644
--- a/cache.h
+++ b/cache.h
@@ -446,7 +446,16 @@ extern int get_common_dir(struct strbuf *sb, const char *gitdir);
extern const char *get_git_namespace(void);
extern const char *strip_namespace(const char *namespaced_ref);
extern const char *get_git_work_tree(void);
-extern const char *read_gitfile(const char *path);
+
+#define READ_GITFILE_ERR_STAT_FAILED 1
+#define READ_GITFILE_ERR_NOT_A_FILE 2
+#define READ_GITFILE_ERR_OPEN_FAILED 3
+#define READ_GITFILE_ERR_READ_FAILED 4
+#define READ_GITFILE_ERR_INVALID_FORMAT 5
+#define READ_GITFILE_ERR_NO_PATH 6
+#define READ_GITFILE_ERR_NOT_A_REPO 7
+extern const char *read_gitfile_gently(const char *path, int *return_error_code);
+#define read_gitfile(path) read_gitfile_gently((path), NULL)
extern const char *resolve_gitdir(const char *suspect);
extern void set_git_work_tree(const char *tree);