Skip to content

Commit 905f969

Browse files
newrengitster
authored andcommitted
path.h: move function declarations for path.c functions from cache.h
Signed-off-by: Elijah Newren <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent f7e552d commit 905f969

File tree

2 files changed

+61
-60
lines changed

2 files changed

+61
-60
lines changed

cache.h

Lines changed: 0 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -1105,7 +1105,6 @@ enum sharedrepo {
11051105
PERM_EVERYBODY = 0664
11061106
};
11071107
int git_config_perm(const char *var, const char *value);
1108-
int adjust_shared_perm(const char *path);
11091108

11101109
/*
11111110
* Create the directory containing the named path, using care to be
@@ -1141,54 +1140,6 @@ enum scld_error safe_create_leading_directories_const(const char *path);
11411140
enum scld_error safe_create_leading_directories_no_share(char *path);
11421141

11431142
int mkdir_in_gitdir(const char *path);
1144-
char *interpolate_path(const char *path, int real_home);
1145-
const char *enter_repo(const char *path, int strict);
1146-
const char *remove_leading_path(const char *in, const char *prefix);
1147-
const char *relative_path(const char *in, const char *prefix, struct strbuf *sb);
1148-
int normalize_path_copy_len(char *dst, const char *src, int *prefix_len);
1149-
int normalize_path_copy(char *dst, const char *src);
1150-
int longest_ancestor_length(const char *path, struct string_list *prefixes);
1151-
char *strip_path_suffix(const char *path, const char *suffix);
1152-
int daemon_avoid_alias(const char *path);
1153-
1154-
/*
1155-
* These functions match their is_hfs_dotgit() counterparts; see utf8.h for
1156-
* details.
1157-
*/
1158-
int is_ntfs_dotgit(const char *name);
1159-
int is_ntfs_dotgitmodules(const char *name);
1160-
int is_ntfs_dotgitignore(const char *name);
1161-
int is_ntfs_dotgitattributes(const char *name);
1162-
int is_ntfs_dotmailmap(const char *name);
1163-
1164-
/*
1165-
* Returns true iff "str" could be confused as a command-line option when
1166-
* passed to a sub-program like "ssh". Note that this has nothing to do with
1167-
* shell-quoting, which should be handled separately; we're assuming here that
1168-
* the string makes it verbatim to the sub-program.
1169-
*/
1170-
int looks_like_command_line_option(const char *str);
1171-
1172-
/**
1173-
* Return a newly allocated string with the evaluation of
1174-
* "$XDG_CONFIG_HOME/$subdir/$filename" if $XDG_CONFIG_HOME is non-empty, otherwise
1175-
* "$HOME/.config/$subdir/$filename". Return NULL upon error.
1176-
*/
1177-
char *xdg_config_home_for(const char *subdir, const char *filename);
1178-
1179-
/**
1180-
* Return a newly allocated string with the evaluation of
1181-
* "$XDG_CONFIG_HOME/git/$filename" if $XDG_CONFIG_HOME is non-empty, otherwise
1182-
* "$HOME/.config/git/$filename". Return NULL upon error.
1183-
*/
1184-
char *xdg_config_home(const char *filename);
1185-
1186-
/**
1187-
* Return a newly allocated string with the evaluation of
1188-
* "$XDG_CACHE_HOME/git/$filename" if $XDG_CACHE_HOME is non-empty, otherwise
1189-
* "$HOME/.cache/git/$filename". Return NULL upon error.
1190-
*/
1191-
char *xdg_cache_home(const char *filename);
11921143

11931144
int git_open_cloexec(const char *name, int flags);
11941145
#define git_open(name) git_open_cloexec(name, O_RDONLY)
@@ -1355,8 +1306,6 @@ int repo_interpret_branch_name(struct repository *r,
13551306
#define interpret_branch_name(str, len, buf, options) \
13561307
repo_interpret_branch_name(the_repository, str, len, buf, options)
13571308

1358-
int validate_headref(const char *ref);
1359-
13601309
int base_name_compare(const char *name1, size_t len1, int mode1,
13611310
const char *name2, size_t len2, int mode2);
13621311
int df_name_compare(const char *name1, size_t len1, int mode1,
@@ -1616,14 +1565,6 @@ void stat_validity_update(struct stat_validity *sv, int fd);
16161565

16171566
int versioncmp(const char *s1, const char *s2);
16181567

1619-
/*
1620-
* Create a directory and (if share is nonzero) adjust its permissions
1621-
* according to the shared_repository setting. Only use this for
1622-
* directories under $GIT_DIR. Don't use it for working tree
1623-
* directories.
1624-
*/
1625-
void safe_create_dir(const char *dir, int share);
1626-
16271568
/*
16281569
* Should we print an ellipsis after an abbreviated SHA-1 value
16291570
* when doing diff-raw output or indicating a detached HEAD?

path.h

Lines changed: 61 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44
struct repository;
55
struct strbuf;
6+
struct string_list;
67

78
/*
89
* The result to all functions which return statically allocated memory may be
@@ -179,7 +180,66 @@ const char *git_path_auto_merge(struct repository *r);
179180
const char *git_path_fetch_head(struct repository *r);
180181
const char *git_path_shallow(struct repository *r);
181182

182-
183183
int ends_with_path_components(const char *path, const char *components);
184+
int validate_headref(const char *ref);
185+
186+
int adjust_shared_perm(const char *path);
187+
188+
char *interpolate_path(const char *path, int real_home);
189+
const char *enter_repo(const char *path, int strict);
190+
const char *remove_leading_path(const char *in, const char *prefix);
191+
const char *relative_path(const char *in, const char *prefix, struct strbuf *sb);
192+
int normalize_path_copy_len(char *dst, const char *src, int *prefix_len);
193+
int normalize_path_copy(char *dst, const char *src);
194+
int longest_ancestor_length(const char *path, struct string_list *prefixes);
195+
char *strip_path_suffix(const char *path, const char *suffix);
196+
int daemon_avoid_alias(const char *path);
197+
198+
/*
199+
* These functions match their is_hfs_dotgit() counterparts; see utf8.h for
200+
* details.
201+
*/
202+
int is_ntfs_dotgit(const char *name);
203+
int is_ntfs_dotgitmodules(const char *name);
204+
int is_ntfs_dotgitignore(const char *name);
205+
int is_ntfs_dotgitattributes(const char *name);
206+
int is_ntfs_dotmailmap(const char *name);
207+
208+
/*
209+
* Returns true iff "str" could be confused as a command-line option when
210+
* passed to a sub-program like "ssh". Note that this has nothing to do with
211+
* shell-quoting, which should be handled separately; we're assuming here that
212+
* the string makes it verbatim to the sub-program.
213+
*/
214+
int looks_like_command_line_option(const char *str);
215+
216+
/**
217+
* Return a newly allocated string with the evaluation of
218+
* "$XDG_CONFIG_HOME/$subdir/$filename" if $XDG_CONFIG_HOME is non-empty, otherwise
219+
* "$HOME/.config/$subdir/$filename". Return NULL upon error.
220+
*/
221+
char *xdg_config_home_for(const char *subdir, const char *filename);
222+
223+
/**
224+
* Return a newly allocated string with the evaluation of
225+
* "$XDG_CONFIG_HOME/git/$filename" if $XDG_CONFIG_HOME is non-empty, otherwise
226+
* "$HOME/.config/git/$filename". Return NULL upon error.
227+
*/
228+
char *xdg_config_home(const char *filename);
229+
230+
/**
231+
* Return a newly allocated string with the evaluation of
232+
* "$XDG_CACHE_HOME/git/$filename" if $XDG_CACHE_HOME is non-empty, otherwise
233+
* "$HOME/.cache/git/$filename". Return NULL upon error.
234+
*/
235+
char *xdg_cache_home(const char *filename);
236+
237+
/*
238+
* Create a directory and (if share is nonzero) adjust its permissions
239+
* according to the shared_repository setting. Only use this for
240+
* directories under $GIT_DIR. Don't use it for working tree
241+
* directories.
242+
*/
243+
void safe_create_dir(const char *dir, int share);
184244

185245
#endif /* PATH_H */

0 commit comments

Comments
 (0)