git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH 3/7] Move print_commit_list to libgit.a

From
Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Date
Oct 26, 2012, 15:53 UTC
Message-ID
<1351266835-22610-4-git-send-email-pclouds@gmail.com>
In-Reply-To
<1351266835-22610-1-git-send-email-pclouds@gmail.com>

This is used by bisect.c, part of libgit.a while it stays in builtin/rev-list.c. Move it to commit.c so that we won't get undefined reference if a program that uses libgit.a happens to pull it in.

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
---
 bisect.h           |  4 ----
 builtin/rev-list.c | 10 ----------
 commit.c           | 10 ++++++++++
 commit.h           |  4 ++++
 4 files changed, 14 insertions(+), 14 deletions(-)
diff --git a/bisect.h b/bisect.h
index ec3c3ff..2a6c831 100644
--- a/bisect.h
+++ b/bisect.h
@@ -11,10 +11,6 @@ extern struct commit_list *filter_skipped(struct commit_list *list,
 					  int *count,
 					  int *skipped_first);
 
-extern void print_commit_list(struct commit_list *list,
-			      const char *format_cur,
-			      const char *format_last);
-
 #define BISECT_SHOW_ALL		(1<<0)
 #define REV_LIST_QUIET		(1<<1)
 
diff --git a/builtin/rev-list.c b/builtin/rev-list.c
index a0ec84e..67701be 100644
--- a/builtin/rev-list.c
+++ b/builtin/rev-list.c
@@ -201,16 +201,6 @@ static void show_edge(struct commit *commit)
 	printf("-%s\n", sha1_to_hex(commit->object.sha1));
 }
 
-void print_commit_list(struct commit_list *list,
-		       const char *format_cur,
-		       const char *format_last)
-{
-	for ( ; list; list = list->next) {
-		const char *format = list->next ? format_cur : format_last;
-		printf(format, sha1_to_hex(list->item->object.sha1));
-	}
-}
-
 static void print_var_str(const char *var, const char *val)
 {
 	printf("%s='%s'\n", var, val);
diff --git a/commit.c b/commit.c
index 213bc98..e8eb0ae 100644
--- a/commit.c
+++ b/commit.c
@@ -1347,3 +1347,13 @@ struct commit_list **commit_list_append(struct commit *commit,
 	new->next = NULL;
 	return &new->next;
 }
+
+void print_commit_list(struct commit_list *list,
+		       const char *format_cur,
+		       const char *format_last)
+{
+	for ( ; list; list = list->next) {
+		const char *format = list->next ? format_cur : format_last;
+		printf(format, sha1_to_hex(list->item->object.sha1));
+	}
+}
diff --git a/commit.h b/commit.h
index 9f21313..c4cd046 100644
--- a/commit.h
+++ b/commit.h
@@ -222,4 +222,8 @@ struct commit *get_merge_parent(const char *name);
 
 extern int parse_signed_commit(const unsigned char *sha1,
 			       struct strbuf *message, struct strbuf *signature);
+extern void print_commit_list(struct commit_list *list,
+			      const char *format_cur,
+			      const char *format_last);
+
 #endif /* COMMIT_H */
-- 
1.8.0.rc2.23.g1fb49df
Previous: Nguyễn Thái Ngọc DuyNext: Nguyễn Thái Ngọc Duy
Message 8 of 13 in “Move try_merge_command and checkout_fast_forward to libgit.a”
  1. Move try_merge_command and checkout_fast_forward to libgit.aNguyễn Thái Ngọc Duy, Oct 23, 2012
  2. Jeff KingOct 25, 2012
  3. Nguyen Thai Ngoc DuyOct 25, 2012
  4. Jeff KingOct 26, 2012
  5. 0/7 Move code from builtin to libgit.aNguyễn Thái Ngọc Duy, Oct 26, 2012
  6. 1/7 Move try_merge_command and checkout_fast_forward to libgit.aNguyễn Thái Ngọc Duy, Oct 26, 2012
  7. 2/7 Move estimate_bisect_steps to libgit.aNguyễn Thái Ngọc Duy, Oct 26, 2012
  8. 3/7 Move print_commit_list to libgit.aNguyễn Thái Ngọc Duy, Oct 26, 2012
  9. 4/7 Move setup_diff_pager to libgit.aNguyễn Thái Ngọc Duy, Oct 26, 2012
  10. 5/7 send-pack: move core code to libgit.aNguyễn Thái Ngọc Duy, Oct 26, 2012
  11. 6/7 fetch-pack: remove global (static) configuration variable "args"Nguyễn Thái Ngọc Duy, Oct 26, 2012
  12. 7/7 fetch-pack: move core code to libgit.aNguyễn Thái Ngọc Duy, Oct 26, 2012
  13. Jeff KingOct 29, 2012

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.