git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: git@vger.kernel.org
Subject: [PATCH] worktree_git_path(): move the declaration to path.h
Date: Sat,  8 Jun 2024 11:39:01 -0700	[thread overview]
Message-ID: <20240608183901.2084546-1-gitster@pobox.com> (raw)

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>
---
 path.h     | 9 +++++++++
 revision.c | 1 +
 worktree.h | 8 --------
 3 files changed, 10 insertions(+), 8 deletions(-)

diff --git a/path.h b/path.h
index c3bc8617bd..a6f0b70692 100644
--- a/path.h
+++ b/path.h
@@ -4,6 +4,7 @@
 struct repository;
 struct strbuf;
 struct string_list;
+struct worktree;
 
 /*
  * The result to all functions which return statically allocated memory may be
@@ -81,6 +82,14 @@ void strbuf_repo_git_path(struct strbuf *sb,
 const char *git_path(const char *fmt, ...)
 	__attribute__((format (printf, 1, 2)));
 
+/*
+ * Similar to git_path() but can produce paths for a specified
+ * worktree instead of current one
+ */
+const char *worktree_git_path(const struct worktree *wt,
+			      const char *fmt, ...)
+	__attribute__((format (printf, 2, 3)));
+
 /*
  * Return a path into the main repository's (the_repository) git directory.
  */
diff --git a/revision.c b/revision.c
index 7ddf0f151a..09024cf4aa 100644
--- a/revision.c
+++ b/revision.c
@@ -29,6 +29,7 @@
 #include "bisect.h"
 #include "packfile.h"
 #include "worktree.h"
+#include "path.h"
 #include "read-cache.h"
 #include "setup.h"
 #include "sparse-index.h"
diff --git a/worktree.h b/worktree.h
index 7cc6d90e66..11279d0c8f 100644
--- a/worktree.h
+++ b/worktree.h
@@ -177,14 +177,6 @@ int other_head_refs(each_ref_fn fn, void *cb_data);
 int is_worktree_being_rebased(const struct worktree *wt, const char *target);
 int is_worktree_being_bisected(const struct worktree *wt, const char *target);
 
-/*
- * Similar to git_path() but can produce paths for a specified
- * worktree instead of current one
- */
-const char *worktree_git_path(const struct worktree *wt,
-			      const char *fmt, ...)
-	__attribute__((format (printf, 2, 3)));
-
 /*
  * Return a refname suitable for access from the current ref store.
  */
-- 
2.45.2-445-g1b76f06508


             reply	other threads:[~2024-06-08 18:39 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-06-08 18:39 Junio C Hamano [this message]
2024-06-14 18:50 ` [PATCH] worktree_git_path(): move the declaration to path.h Elijah Newren
2024-06-14 19:21   ` Junio C Hamano

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=20240608183901.2084546-1-gitster@pobox.com \
    --to=gitster@pobox.com \
    --cc=git@vger.kernel.org \
    /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).