aboutsummaryrefslogtreecommitdiff
path: root/path.h
diff options
context:
space:
mode:
authorPatrick Steinhardt <ps@pks.im>2025-02-07 12:03:28 +0100
committerJunio C Hamano <gitster@pobox.com>2025-02-07 09:59:21 -0800
commit93a8cfaf3c24f8c1f999b2ca5532ff8f46e0808d (patch)
treef64efa23c359303513f89a6c321e93f22015df9b /path.h
parentbdfc07bfdf3f4f4ef94580c0cb46eef5977bb810 (diff)
downloadgit-93a8cfaf3c24f8c1f999b2ca5532ff8f46e0808d.tar.xz
path: refactor `repo_worktree_path()` family of functions
As explained in an earlier commit, we're refactoring path-related functions to provide a consistent interface for computing paths into the commondir, gitdir and worktree. Refactor the "worktree" family of functions accordingly. Signed-off-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'path.h')
-rw-r--r--path.h20
1 files changed, 9 insertions, 11 deletions
diff --git a/path.h b/path.h
index c45311b0a8..d3f85f0676 100644
--- a/path.h
+++ b/path.h
@@ -75,24 +75,22 @@ const char *worktree_git_path(struct repository *r,
__attribute__((format (printf, 3, 4)));
/*
- * Return a path into the worktree of repository `repo`.
+ * The `repo_worktree_path` family of functions will construct a path into a
+ * repository's worktree.
*
- * If the repository doesn't have a worktree NULL is returned.
+ * Returns a `NULL` pointer in case the repository has no worktree.
*/
char *repo_worktree_path(const struct repository *repo,
const char *fmt, ...)
__attribute__((format (printf, 2, 3)));
-
-/*
- * Construct a path into the worktree of repository `repo` and append it
- * to the provided buffer `sb`.
- *
- * If the repository doesn't have a worktree nothing will be appended to `sb`.
- */
-void strbuf_repo_worktree_path(struct strbuf *sb,
- const struct repository *repo,
+const char *repo_worktree_path_append(const struct repository *repo,
+ struct strbuf *sb,
const char *fmt, ...)
__attribute__((format (printf, 3, 4)));
+const char *repo_worktree_path_replace(const struct repository *repo,
+ struct strbuf *sb,
+ const char *fmt, ...)
+ __attribute__((format (printf, 3, 4)));
/*
* Return a path into a submodule's git directory located at `path`. `path`