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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

Signed-off-by: Junio C Hamano <junkio@xxxxxxx>
---
 * 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


-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]