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

[PATCH 4/4] git-bundle: --list-prereqs

From
Junio C Hamano <junkio@cox.net>
Date
Mar 6, 2007, 00:41 UTC
Message-ID
<7vodn7ursq.fsf@assigned-by-dhcp.cox.net>
In-Reply-To
<7vk5xvw6mg.fsf@assigned-by-dhcp.cox.net>

This is primarily of interest while debugging the bundle creation, but there may be other uses.

Signed-off-by: Junio C Hamano <junkio@cox.net>
---
 * I am not sure if this should be a separate command, but the
   current command set did not have a way to review prereqs,
   short of:
	sed -ne '/^PACK/q' -e 'p' bundle.bdl
   It would make sense to have 'git bundle verify' output the
   heads and prereqs, maybe with --verbose, but I think doing
   that always might be even more helpful.
 builtin-bundle.c |   18 +++++++++++++++++-
 1 files changed, 17 insertions(+), 1 deletions(-)
diff --git a/builtin-bundle.c b/builtin-bundle.c
index 9286f3d..4fe74a7 100644
--- a/builtin-bundle.c
+++ b/builtin-bundle.c
@@ -241,6 +241,19 @@ static int list_heads(struct bundle_header *header, int argc, const char **argv)
 	return 0;
 }
 
+static int list_prereqs(struct bundle_header *header, int argc, const char **argv)
+{
+	int i;
+
+	struct ref_list *p = &header->prerequisites;
+	for (i = 0; i < p->nr; i++) {
+		printf("%s %s\n",
+		       sha1_to_hex(p->list[i].sha1),
+		       p->list[i].name);
+	}
+	return 0;
+}
+
 static void show_commit(struct commit *commit)
 {
 	write_or_die(1, sha1_to_hex(commit->object.sha1), 40);
@@ -432,6 +445,10 @@ int cmd_bundle(int argc, const char **argv, const char *prefix)
 		close(bundle_fd);
 		return !!list_heads(&header, argc, argv);
 	}
+	if (!strcmp(cmd, "list-prereqs")) {
+		close(bundle_fd);
+		return !!list_prereqs(&header, argc, argv);
+	}
 	if (!strcmp(cmd, "create")) {
 		if (nongit)
 			die("Need a repository to create a bundle.");
@@ -443,4 +460,3 @@ int cmd_bundle(int argc, const char **argv, const char *prefix)
 	} else
 		usage(bundle_usage);
 }
-
-- 
1.5.0.3.862.g71037
Previous: Johannes SchindelinNext: Junio C Hamano
Message 25 of 26 in “[BUG] git-rev-list: --topo-order --boundary and --max-count”
  1. Santi BéjarMar 5, 2007
  2. Junio C HamanoMar 5, 2007
  3. Junio C HamanoMar 5, 2007
  4. Linus TorvaldsMar 5, 2007
  5. revision walker: Fix --boundary when limitedJohannes Schindelin, Mar 5, 2007
  6. Johannes SchindelinMar 5, 2007
  7. Linus TorvaldsMar 5, 2007
  8. Linus TorvaldsMar 5, 2007
  9. Junio C HamanoMar 5, 2007
  10. Johannes SchindelinMar 6, 2007
  11. Junio C HamanoMar 6, 2007
  12. Johannes SchindelinMar 6, 2007
  13. Junio C HamanoMar 6, 2007
  14. Johannes SchindelinMar 5, 2007
  15. Junio C HamanoMar 6, 2007
  16. 2/4 revision traversal: retire BOUNDARY_SHOWJunio C Hamano, Mar 6, 2007
  17. Johannes SchindelinMar 6, 2007
  18. Junio C HamanoMar 6, 2007
  19. SHOWN means shownJunio C Hamano, Mar 6, 2007
  20. Johannes SchindelinMar 6, 2007
  21. Junio C HamanoMar 6, 2007
  22. Johannes SchindelinMar 6, 2007
  23. 3/4 git-bundle: various fixupsJunio C Hamano, Mar 6, 2007
  24. Johannes SchindelinMar 6, 2007
  25. 4/4 git-bundle: --list-prereqsJunio C Hamano, Mar 6, 2007
  26. Junio C HamanoMar 5, 2007

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.