Brandon Williams | e7d72d0 | 2017-06-22 11:43:35 -0700 | [diff] [blame] | 1 | #ifndef PATH_H |
| 2 | #define PATH_H |
| 3 | |
Brandon Williams | b337172 | 2017-06-22 11:43:37 -0700 | [diff] [blame] | 4 | struct repository; |
| 5 | |
Brandon Williams | e7d72d0 | 2017-06-22 11:43:35 -0700 | [diff] [blame] | 6 | /* |
| 7 | * Return a statically allocated filename, either generically (mkpath), in |
| 8 | * the repository directory (git_path), or in a submodule's repository |
| 9 | * directory (git_path_submodule). In all cases, note that the result |
| 10 | * may be overwritten by another call to _any_ of the functions. Consider |
| 11 | * using the safer "dup" or "strbuf" formats below (in some cases, the |
| 12 | * unsafe versions have already been removed). |
| 13 | */ |
| 14 | extern const char *mkpath(const char *fmt, ...) __attribute__((format (printf, 1, 2))); |
| 15 | extern const char *git_path(const char *fmt, ...) __attribute__((format (printf, 1, 2))); |
| 16 | extern const char *git_common_path(const char *fmt, ...) __attribute__((format (printf, 1, 2))); |
| 17 | |
| 18 | extern char *mksnpath(char *buf, size_t n, const char *fmt, ...) |
| 19 | __attribute__((format (printf, 3, 4))); |
| 20 | extern void strbuf_git_path(struct strbuf *sb, const char *fmt, ...) |
| 21 | __attribute__((format (printf, 2, 3))); |
Brandon Williams | b337172 | 2017-06-22 11:43:37 -0700 | [diff] [blame] | 22 | extern void strbuf_git_common_path(struct strbuf *sb, |
| 23 | const struct repository *repo, |
| 24 | const char *fmt, ...) |
| 25 | __attribute__((format (printf, 3, 4))); |
Brandon Williams | e7d72d0 | 2017-06-22 11:43:35 -0700 | [diff] [blame] | 26 | extern char *git_path_buf(struct strbuf *buf, const char *fmt, ...) |
| 27 | __attribute__((format (printf, 2, 3))); |
| 28 | extern int strbuf_git_path_submodule(struct strbuf *sb, const char *path, |
| 29 | const char *fmt, ...) |
| 30 | __attribute__((format (printf, 3, 4))); |
| 31 | extern char *git_pathdup(const char *fmt, ...) |
| 32 | __attribute__((format (printf, 1, 2))); |
| 33 | extern char *mkpathdup(const char *fmt, ...) |
| 34 | __attribute__((format (printf, 1, 2))); |
| 35 | extern char *git_pathdup_submodule(const char *path, const char *fmt, ...) |
| 36 | __attribute__((format (printf, 2, 3))); |
| 37 | |
Brandon Williams | 3181d86 | 2017-06-22 11:43:40 -0700 | [diff] [blame] | 38 | extern char *repo_git_path(const struct repository *repo, |
| 39 | const char *fmt, ...) |
| 40 | __attribute__((format (printf, 2, 3))); |
| 41 | extern void strbuf_repo_git_path(struct strbuf *sb, |
| 42 | const struct repository *repo, |
| 43 | const char *fmt, ...) |
| 44 | __attribute__((format (printf, 3, 4))); |
| 45 | |
Brandon Williams | b42b0c0 | 2017-06-22 11:43:41 -0700 | [diff] [blame] | 46 | extern char *repo_worktree_path(const struct repository *repo, |
| 47 | const char *fmt, ...) |
| 48 | __attribute__((format (printf, 2, 3))); |
| 49 | extern void strbuf_repo_worktree_path(struct strbuf *sb, |
| 50 | const struct repository *repo, |
| 51 | const char *fmt, ...) |
| 52 | __attribute__((format (printf, 3, 4))); |
| 53 | |
Brandon Williams | e7d72d0 | 2017-06-22 11:43:35 -0700 | [diff] [blame] | 54 | extern void report_linked_checkout_garbage(void); |
| 55 | |
| 56 | /* |
| 57 | * You can define a static memoized git path like: |
| 58 | * |
| 59 | * static GIT_PATH_FUNC(git_path_foo, "FOO"); |
| 60 | * |
| 61 | * or use one of the global ones below. |
| 62 | */ |
| 63 | #define GIT_PATH_FUNC(func, filename) \ |
| 64 | const char *func(void) \ |
| 65 | { \ |
| 66 | static char *ret; \ |
| 67 | if (!ret) \ |
| 68 | ret = git_pathdup(filename); \ |
| 69 | return ret; \ |
| 70 | } |
| 71 | |
| 72 | const char *git_path_cherry_pick_head(void); |
| 73 | const char *git_path_revert_head(void); |
| 74 | const char *git_path_squash_msg(void); |
| 75 | const char *git_path_merge_msg(void); |
| 76 | const char *git_path_merge_rr(void); |
| 77 | const char *git_path_merge_mode(void); |
| 78 | const char *git_path_merge_head(void); |
| 79 | const char *git_path_fetch_head(void); |
| 80 | const char *git_path_shallow(void); |
| 81 | |
| 82 | #endif /* PATH_H */ |