worktree_git_path(): move the declaration to path.h
The definition of this function is in path.c but its declaration is in worktree.h, which is something unexpected. The function is explained as "Similar to git_path()"; declaring it next to where git_path() is declared would make more sense. Signed-off-by: Junio C Hamano <gitster@pobox.com>
Junio C Hamano committed
Jun 8, 2024 at 11:39 UTC
bf6a86236e829d08c92356e5c861193ccb516ef7
3 files changed
+10
-8
path.h
+9
@@ -4,6 +4,7 @@
4
struct repository;
5
struct strbuf;
6
struct string_list;
7
+struct worktree;
8
9
/*
10
* The result to all functions which return statically allocated memory may be
@@ -81,6 +82,14 @@ void strbuf_repo_git_path(struct strbuf *sb,
82
const char *git_path(const char *fmt, ...)
83
__attribute__((format (printf, 1, 2)));
84
85
+/*
86
+ * Similar to git_path() but can produce paths for a specified
87
+ * worktree instead of current one
88
+ */
89
+const char *worktree_git_path(const struct worktree *wt,
90
+ const char *fmt, ...)
91
+ __attribute__((format (printf, 2, 3)));
92
+
93
/*
94
* Return a path into the main repository's (the_repository) git directory.
95
*/
revision.c
+1
@@ -29,6 +29,7 @@
29
#include "bisect.h"
30
#include "packfile.h"
31
#include "worktree.h"
32
+#include "path.h"
33
#include "read-cache.h"
34
#include "setup.h"
35
#include "sparse-index.h"
worktree.h
-8
@@ -175,14 +175,6 @@ int other_head_refs(each_ref_fn fn, void *cb_data);
175
int is_worktree_being_rebased(const struct worktree *wt, const char *target);
176
int is_worktree_being_bisected(const struct worktree *wt, const char *target);
177
178
-/*
179
- * Similar to git_path() but can produce paths for a specified
180
- * worktree instead of current one
181
- */
182
-const char *worktree_git_path(const struct worktree *wt,
183
- const char *fmt, ...)
184
- __attribute__((format (printf, 2, 3)));
185
-
178
/*
179
* Return a refname suitable for access from the current ref store.
180
*/