From: "Elijah Newren via GitGitGadget" <gitgitgadget@gmail.com>
To: git@vger.kernel.org
Cc: "Ævar Arnfjörð Bjarmason" <avarab@gmail.com>,
"Elijah Newren" <newren@gmail.com>,
"Elijah Newren" <newren@gmail.com>,
"Elijah Newren" <newren@gmail.com>
Subject: [PATCH v2 08/16] path.h: move function declarations for path.c functions from cache.h
Date: Tue, 21 Mar 2023 06:26:00 +0000 [thread overview]
Message-ID: <b0bfbe7f38c99e4371265f0e92fbe38adfc09bd8.1679379972.git.gitgitgadget@gmail.com> (raw)
In-Reply-To: <pull.1493.v2.git.1679379968.gitgitgadget@gmail.com>
From: Elijah Newren <newren@gmail.com>
Signed-off-by: Elijah Newren <newren@gmail.com>
---
cache.h | 59 ------------------------------------------------------
path.h | 62 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++-
2 files changed, 61 insertions(+), 60 deletions(-)
diff --git a/cache.h b/cache.h
index 978aa01712b..705c41992bc 100644
--- a/cache.h
+++ b/cache.h
@@ -1105,7 +1105,6 @@ enum sharedrepo {
PERM_EVERYBODY = 0664
};
int git_config_perm(const char *var, const char *value);
-int adjust_shared_perm(const char *path);
/*
* 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);
enum scld_error safe_create_leading_directories_no_share(char *path);
int mkdir_in_gitdir(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 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);
-
-/*
- * These functions match their is_hfs_dotgit() counterparts; see utf8.h for
- * details.
- */
-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);
-
-/*
- * Returns true iff "str" could be confused as a command-line option when
- * passed to a sub-program like "ssh". Note that this has nothing to do with
- * shell-quoting, which should be handled separately; we're assuming here that
- * the string makes it verbatim to the sub-program.
- */
-int looks_like_command_line_option(const char *str);
-
-/**
- * Return a newly allocated string with the evaluation of
- * "$XDG_CONFIG_HOME/$subdir/$filename" if $XDG_CONFIG_HOME is non-empty, otherwise
- * "$HOME/.config/$subdir/$filename". Return NULL upon error.
- */
-char *xdg_config_home_for(const char *subdir, const char *filename);
-
-/**
- * Return a newly allocated string with the evaluation of
- * "$XDG_CONFIG_HOME/git/$filename" if $XDG_CONFIG_HOME is non-empty, otherwise
- * "$HOME/.config/git/$filename". Return NULL upon error.
- */
-char *xdg_config_home(const char *filename);
-
-/**
- * Return a newly allocated string with the evaluation of
- * "$XDG_CACHE_HOME/git/$filename" if $XDG_CACHE_HOME is non-empty, otherwise
- * "$HOME/.cache/git/$filename". Return NULL upon error.
- */
-char *xdg_cache_home(const char *filename);
int git_open_cloexec(const char *name, int flags);
#define git_open(name) git_open_cloexec(name, O_RDONLY)
@@ -1355,8 +1306,6 @@ int repo_interpret_branch_name(struct repository *r,
#define interpret_branch_name(str, len, buf, options) \
repo_interpret_branch_name(the_repository, str, len, buf, options)
-int validate_headref(const char *ref);
-
int base_name_compare(const char *name1, size_t len1, int mode1,
const char *name2, size_t len2, int mode2);
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);
int versioncmp(const char *s1, const char *s2);
-/*
- * Create a directory and (if share is nonzero) adjust its permissions
- * according to the shared_repository setting. Only use this for
- * directories under $GIT_DIR. Don't use it for working tree
- * directories.
- */
-void safe_create_dir(const char *dir, int share);
-
/*
* Should we print an ellipsis after an abbreviated SHA-1 value
* when doing diff-raw output or indicating a detached HEAD?
diff --git a/path.h b/path.h
index 0a59c85a62e..60e83a49a98 100644
--- a/path.h
+++ b/path.h
@@ -3,6 +3,7 @@
struct repository;
struct strbuf;
+struct string_list;
/*
* 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);
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 validate_headref(const char *ref);
+
+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 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);
+
+/*
+ * These functions match their is_hfs_dotgit() counterparts; see utf8.h for
+ * details.
+ */
+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);
+
+/*
+ * Returns true iff "str" could be confused as a command-line option when
+ * passed to a sub-program like "ssh". Note that this has nothing to do with
+ * shell-quoting, which should be handled separately; we're assuming here that
+ * the string makes it verbatim to the sub-program.
+ */
+int looks_like_command_line_option(const char *str);
+
+/**
+ * Return a newly allocated string with the evaluation of
+ * "$XDG_CONFIG_HOME/$subdir/$filename" if $XDG_CONFIG_HOME is non-empty, otherwise
+ * "$HOME/.config/$subdir/$filename". Return NULL upon error.
+ */
+char *xdg_config_home_for(const char *subdir, const char *filename);
+
+/**
+ * Return a newly allocated string with the evaluation of
+ * "$XDG_CONFIG_HOME/git/$filename" if $XDG_CONFIG_HOME is non-empty, otherwise
+ * "$HOME/.config/git/$filename". Return NULL upon error.
+ */
+char *xdg_config_home(const char *filename);
+
+/**
+ * Return a newly allocated string with the evaluation of
+ * "$XDG_CACHE_HOME/git/$filename" if $XDG_CACHE_HOME is non-empty, otherwise
+ * "$HOME/.cache/git/$filename". Return NULL upon error.
+ */
+char *xdg_cache_home(const char *filename);
+
+/*
+ * Create a directory and (if share is nonzero) adjust its permissions
+ * according to the shared_repository setting. Only use this for
+ * directories under $GIT_DIR. Don't use it for working tree
+ * directories.
+ */
+void safe_create_dir(const char *dir, int share);
#endif /* PATH_H */
--
gitgitgadget
next prev parent reply other threads:[~2023-03-21 6:26 UTC|newest]
Thread overview: 37+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-03-19 6:27 [PATCH 00/16] Header cleanups Elijah Newren via GitGitGadget
2023-03-19 6:27 ` [PATCH 01/16] treewide: remove unnecessary cache.h inclusion from a few headers Elijah Newren via GitGitGadget
2023-03-19 6:27 ` [PATCH 02/16] treewide: be explicit about dependence on gettext.h Elijah Newren via GitGitGadget
2023-03-19 6:27 ` [PATCH 03/16] treewide: remove unnecessary inclusion of gettext.h Elijah Newren via GitGitGadget
2023-03-19 6:27 ` [PATCH 04/16] treewide: remove unnecessary cache.h inclusion from several sources Elijah Newren via GitGitGadget
2023-03-19 6:27 ` [PATCH 05/16] environment: move comment_line_char from cache.h Elijah Newren via GitGitGadget
2023-03-19 6:27 ` [PATCH 06/16] abspath.h: move absolute path functions " Elijah Newren via GitGitGadget
2023-03-19 6:27 ` [PATCH 07/16] cache.h: remove expand_user_path() Elijah Newren via GitGitGadget
2023-03-19 6:27 ` [PATCH 08/16] path.h: move function declarations for path.c functions from cache.h Elijah Newren via GitGitGadget
2023-03-19 6:27 ` [PATCH 09/16] wrapper.h: move declarations for wrapper.c " Elijah Newren via GitGitGadget
2023-03-19 6:27 ` [PATCH 10/16] treewide: remove unnecessary includes of cache.h Elijah Newren via GitGitGadget
2023-03-19 6:27 ` [PATCH 11/16] environment.h: move declarations for environment.c functions from cache.h Elijah Newren via GitGitGadget
2023-03-19 6:27 ` [PATCH 12/16] treewide: remove cache.h inclusion due to environment.h changes Elijah Newren via GitGitGadget
2023-03-19 6:27 ` [PATCH 13/16] setup.h: move declarations for setup.c functions from cache.h Elijah Newren via GitGitGadget
2023-03-19 6:28 ` [PATCH 14/16] treewide: remove cache.h inclusion due to setup.h changes Elijah Newren via GitGitGadget
2023-03-19 6:28 ` [PATCH 15/16] write-or-die.h: move declarations for write-or-die.c functions from cache.h Elijah Newren via GitGitGadget
2023-03-19 6:28 ` [PATCH 16/16] csum-file.h: remove unnecessary inclusion of cache.h Elijah Newren via GitGitGadget
2023-03-20 9:58 ` [PATCH 00/16] Header cleanups Ævar Arnfjörð Bjarmason
2023-03-20 16:18 ` Elijah Newren
2023-03-21 6:25 ` [PATCH v2 " Elijah Newren via GitGitGadget
2023-03-21 6:25 ` [PATCH v2 01/16] treewide: remove unnecessary cache.h inclusion from a few headers Elijah Newren via GitGitGadget
2023-03-21 6:25 ` [PATCH v2 02/16] treewide: be explicit about dependence on gettext.h Elijah Newren via GitGitGadget
2023-03-21 6:25 ` [PATCH v2 03/16] treewide: remove unnecessary inclusion of gettext.h Elijah Newren via GitGitGadget
2023-03-21 6:25 ` [PATCH v2 04/16] treewide: remove unnecessary cache.h inclusion from several sources Elijah Newren via GitGitGadget
2023-03-21 6:25 ` [PATCH v2 05/16] environment: move comment_line_char from cache.h Elijah Newren via GitGitGadget
2023-03-21 6:25 ` [PATCH v2 06/16] abspath.h: move absolute path functions " Elijah Newren via GitGitGadget
2023-03-21 6:25 ` [PATCH v2 07/16] cache.h: remove expand_user_path() Elijah Newren via GitGitGadget
2023-03-21 6:26 ` Elijah Newren via GitGitGadget [this message]
2023-03-21 6:26 ` [PATCH v2 09/16] wrapper.h: move declarations for wrapper.c functions from cache.h Elijah Newren via GitGitGadget
2023-03-21 6:26 ` [PATCH v2 10/16] treewide: remove unnecessary includes of cache.h Elijah Newren via GitGitGadget
2023-03-21 6:26 ` [PATCH v2 11/16] environment.h: move declarations for environment.c functions from cache.h Elijah Newren via GitGitGadget
2023-03-21 6:26 ` [PATCH v2 12/16] treewide: remove cache.h inclusion due to environment.h changes Elijah Newren via GitGitGadget
2023-03-21 6:26 ` [PATCH v2 13/16] setup.h: move declarations for setup.c functions from cache.h Elijah Newren via GitGitGadget
2023-03-21 6:26 ` [PATCH v2 14/16] treewide: remove cache.h inclusion due to setup.h changes Elijah Newren via GitGitGadget
2023-03-21 6:26 ` [PATCH v2 15/16] write-or-die.h: move declarations for write-or-die.c functions from cache.h Elijah Newren via GitGitGadget
2023-03-21 6:26 ` [PATCH v2 16/16] csum-file.h: remove unnecessary inclusion of cache.h Elijah Newren via GitGitGadget
2023-03-21 21:56 ` [PATCH v2 00/16] Header cleanups Jonathan Tan
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=b0bfbe7f38c99e4371265f0e92fbe38adfc09bd8.1679379972.git.gitgitgadget@gmail.com \
--to=gitgitgadget@gmail.com \
--cc=avarab@gmail.com \
--cc=git@vger.kernel.org \
--cc=newren@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).