path.h: move function declarations for path.c functions from cache.h

Signed-off-by: Elijah Newren <newren@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Elijah Newren committed Mar 21, 2023 at 06:26 UTC 905f96939b7887e532c84747ef51466a959b6eb9
2 files changed +61 -60
cache.h
-59
@@ -1105,7 +1105,6 @@ enum sharedrepo {
1105 PERM_EVERYBODY = 0664
1106 };
1107 int git_config_perm(const char *var, const char *value);
1108 -int adjust_shared_perm(const char *path);
1108
1109 /*
1110 * 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);
1140 enum scld_error safe_create_leading_directories_no_share(char *path);
1141
1142 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);
1143
1144 int git_open_cloexec(const char *name, int flags);
1145 #define git_open(name) git_open_cloexec(name, O_RDONLY)
@@ -1355,8 +1306,6 @@ int repo_interpret_branch_name(struct repository *r,
1306 #define interpret_branch_name(str, len, buf, options) \
1307 repo_interpret_branch_name(the_repository, str, len, buf, options)
1308
1358 -int validate_headref(const char *ref);
1359 -
1309 int base_name_compare(const char *name1, size_t len1, int mode1,
1310 const char *name2, size_t len2, int mode2);
1311 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);
1565
1566 int versioncmp(const char *s1, const char *s2);
1567
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 -
1568 /*
1569 * Should we print an ellipsis after an abbreviated SHA-1 value
1570 * when doing diff-raw output or indicating a detached HEAD?
path.h
+61 -1
@@ -3,6 +3,7 @@
3
4 struct repository;
5 struct strbuf;
6 +struct string_list;
7
8 /*
9 * 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);
180 const char *git_path_fetch_head(struct repository *r);
181 const char *git_path_shallow(struct repository *r);
182
182 -
183 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);
244
245 #endif /* PATH_H */