Skip to content

Commit bf6a862

Browse files
committed
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 <[email protected]>
1 parent 786a3e4 commit bf6a862

File tree

3 files changed

+10
-8
lines changed

3 files changed

+10
-8
lines changed

path.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
struct repository;
55
struct strbuf;
66
struct string_list;
7+
struct worktree;
78

89
/*
910
* The result to all functions which return statically allocated memory may be
@@ -81,6 +82,14 @@ void strbuf_repo_git_path(struct strbuf *sb,
8182
const char *git_path(const char *fmt, ...)
8283
__attribute__((format (printf, 1, 2)));
8384

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+
8493
/*
8594
* Return a path into the main repository's (the_repository) git directory.
8695
*/

revision.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
#include "bisect.h"
3030
#include "packfile.h"
3131
#include "worktree.h"
32+
#include "path.h"
3233
#include "read-cache.h"
3334
#include "setup.h"
3435
#include "sparse-index.h"

worktree.h

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -175,14 +175,6 @@ int other_head_refs(each_ref_fn fn, void *cb_data);
175175
int is_worktree_being_rebased(const struct worktree *wt, const char *target);
176176
int is_worktree_being_bisected(const struct worktree *wt, const char *target);
177177

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-
186178
/*
187179
* Return a refname suitable for access from the current ref store.
188180
*/

0 commit comments

Comments
 (0)