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