#ifndef PATH_H
#define PATH_H
struct repository;
struct strbuf;
struct string_list;
struct worktree;
const char *mkpath(const char *fmt, ...)
__attribute__((format (printf, 1, 2)));
char *mkpathdup(const char *fmt, ...)
__attribute__((format (printf, 1, 2)));
void strbuf_git_common_path(struct strbuf *sb,
const struct repository *repo,
const char *fmt, ...)
__attribute__((format (printf, 3, 4)));
void repo_common_pathv(const struct repository *repo,
struct strbuf *buf,
const char *fmt,
va_list args);
char *repo_git_path(const struct repository *repo,
const char *fmt, ...)
__attribute__((format (printf, 2, 3)));
void repo_git_pathv(const struct repository *repo,
const struct worktree *wt, struct strbuf *buf,
const char *fmt, va_list args);
void strbuf_repo_git_path(struct strbuf *sb,
const struct repository *repo,
const char *fmt, ...)
__attribute__((format (printf, 3, 4)));
const char *worktree_git_path(struct repository *r,
const struct worktree *wt,
const char *fmt, ...)
__attribute__((format (printf, 3, 4)));
char *repo_worktree_path(const struct repository *repo,
const char *fmt, ...)
__attribute__((format (printf, 2, 3)));
void strbuf_repo_worktree_path(struct strbuf *sb,
const struct repository *repo,
const char *fmt, ...)
__attribute__((format (printf, 3, 4)));
char *git_pathdup_submodule(const char *path, const char *fmt, ...)
__attribute__((format (printf, 2, 3)));
int strbuf_git_path_submodule(struct strbuf *sb, const char *path,
const char *fmt, ...)
__attribute__((format (printf, 3, 4)));
void report_linked_checkout_garbage(struct repository *r);
#define REPO_GIT_PATH_FUNC(var, filename) …
const char *git_path_squash_msg(struct repository *r);
const char *git_path_merge_msg(struct repository *r);
const char *git_path_merge_rr(struct repository *r);
const char *git_path_merge_mode(struct repository *r);
const char *git_path_merge_head(struct repository *r);
const char *git_path_fetch_head(struct repository *r);
const char *git_path_shallow(struct repository *r);
int ends_with_path_components(const char *path, const char *components);
int calc_shared_perm(int mode);
int adjust_shared_perm(const char *path);
char *interpolate_path(const char *path, int real_home);
const char *enter_repo(const char *path, int strict);
const char *remove_leading_path(const char *in, const char *prefix);
const char *relative_path(const char *in, const char *prefix, struct strbuf *sb);
int normalize_path_copy_len(char *dst, const char *src, int *prefix_len);
int normalize_path_copy(char *dst, const char *src);
int strbuf_normalize_path(struct strbuf *src);
int longest_ancestor_length(const char *path, struct string_list *prefixes);
char *strip_path_suffix(const char *path, const char *suffix);
int daemon_avoid_alias(const char *path);
int is_ntfs_dotgit(const char *name);
int is_ntfs_dotgitmodules(const char *name);
int is_ntfs_dotgitignore(const char *name);
int is_ntfs_dotgitattributes(const char *name);
int is_ntfs_dotmailmap(const char *name);
int looks_like_command_line_option(const char *str);
char *xdg_config_home_for(const char *subdir, const char *filename);
char *xdg_config_home(const char *filename);
char *xdg_cache_home(const char *filename);
void safe_create_dir(const char *dir, int share);
struct strbuf *get_pathname(void);
# ifdef USE_THE_REPOSITORY_VARIABLE
# include "strbuf.h"
# include "repository.h"
__attribute__((format (printf, 1, 2)))
static inline const char *git_common_path(const char *fmt, ...)
{
struct strbuf *pathname = get_pathname();
va_list args;
va_start(args, fmt);
repo_common_pathv(the_repository, pathname, fmt, args);
va_end(args);
return pathname->buf;
}
__attribute__((format (printf, 2, 3)))
static inline char *git_path_buf(struct strbuf *buf, const char *fmt, ...)
{
va_list args;
strbuf_reset(buf);
va_start(args, fmt);
repo_git_pathv(the_repository, NULL, buf, fmt, args);
va_end(args);
return buf->buf;
}
__attribute__((format (printf, 2, 3)))
static inline void strbuf_git_path(struct strbuf *sb, const char *fmt, ...)
{
va_list args;
va_start(args, fmt);
repo_git_pathv(the_repository, NULL, sb, fmt, args);
va_end(args);
}
__attribute__((format (printf, 1, 2)))
static inline const char *git_path(const char *fmt, ...)
{
struct strbuf *pathname = get_pathname();
va_list args;
va_start(args, fmt);
repo_git_pathv(the_repository, NULL, pathname, fmt, args);
va_end(args);
return pathname->buf;
}
#define GIT_PATH_FUNC …
__attribute__((format (printf, 1, 2)))
static inline char *git_pathdup(const char *fmt, ...)
{
struct strbuf path = STRBUF_INIT;
va_list args;
va_start(args, fmt);
repo_git_pathv(the_repository, NULL, &path, fmt, args);
va_end(args);
return strbuf_detach(&path, NULL);
}
# endif
#endif