summaryrefslogtreecommitdiff
path: root/cache.h
diff options
context:
space:
mode:
authorNguyễn Thái Ngọc Duy <pclouds@gmail.com>2016-04-22 20:01:25 +0700
committerJunio C Hamano <gitster@pobox.com>2016-04-22 14:09:37 -0700
commit15cdfea734ffce99d930e8e8016787b57ac47386 (patch)
tree0a13e0dab1ded2082126a48d874b0db95dd6fe41 /cache.h
parentba0897e6ae6b0b3f259efb31be0f1ab3d820aacf (diff)
downloadgit-15cdfea734ffce99d930e8e8016787b57ac47386.tar.gz
path.c: add git_common_path() and strbuf_git_common_path()
These are mostly convenient functions to reduce code duplication. Most of the time, we should be able to get by with git_path() which handles $GIT_COMMON_DIR internally. However there are a few cases where we need to construct paths manually, for example some paths from a specific worktree. These functions will enable that. Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'cache.h')
-rw-r--r--cache.h3
1 files changed, 3 insertions, 0 deletions
diff --git a/cache.h b/cache.h
index 2711048cad..c04a17f8d0 100644
--- a/cache.h
+++ b/cache.h
@@ -799,11 +799,14 @@ extern void check_repository_format(void);
*/
extern const char *mkpath(const char *fmt, ...) __attribute__((format (printf, 1, 2)));
extern const char *git_path(const char *fmt, ...) __attribute__((format (printf, 1, 2)));
+extern const char *git_common_path(const char *fmt, ...) __attribute__((format (printf, 1, 2)));
extern char *mksnpath(char *buf, size_t n, const char *fmt, ...)
__attribute__((format (printf, 3, 4)));
extern void strbuf_git_path(struct strbuf *sb, const char *fmt, ...)
__attribute__((format (printf, 2, 3)));
+extern void strbuf_git_common_path(struct strbuf *sb, const char *fmt, ...)
+ __attribute__((format (printf, 2, 3)));
extern char *git_path_buf(struct strbuf *buf, const char *fmt, ...)
__attribute__((format (printf, 2, 3)));
extern void strbuf_git_path_submodule(struct strbuf *sb, const char *path,