git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Add git-index-pack -l to list objects in a pack
@ 2007-06-06  9:39 Sam Vilain
  2007-06-06 13:55 ` Nicolas Pitre
  0 siblings, 1 reply; 4+ messages in thread
From: Sam Vilain @ 2007-06-06  9:39 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git, Sam Vilain

I couldn't figure out how to make git-unpack-objects -n work.
But it seems to be easy in the loop in index-pack
---
 index-pack.c |    8 +++++++-
 1 files changed, 7 insertions(+), 1 deletions(-)

diff --git a/index-pack.c b/index-pack.c
index 82c8da3..f657db7 100644
--- a/index-pack.c
+++ b/index-pack.c
@@ -45,6 +45,7 @@ static int nr_resolved_deltas;
 
 static int from_stdin;
 static int verbose;
+static int list_objects;
 
 static struct progress progress;
 
@@ -717,6 +718,8 @@ int main(int argc, char **argv)
 				if (*c)
 					die("bad %s", arg);
 				input_len = sizeof(*hdr);
+			} else if (!strcmp(arg, "-l")) {
+				list_objects = 1;
 			} else if (!strcmp(arg, "-v")) {
 				verbose = 1;
 			} else if (!strcmp(arg, "-o")) {
@@ -802,8 +805,11 @@ int main(int argc, char **argv)
 	free(deltas);
 
 	idx_objects = xmalloc((nr_objects) * sizeof(struct pack_idx_entry *));
-	for (i = 0; i < nr_objects; i++)
+	for (i = 0; i < nr_objects; i++) {
 		idx_objects[i] = &objects[i].idx;
+		if (list_objects)
+			printf("%s\n", sha1_to_hex(idx_objects[i]->sha1));
+	}
 	curr_index = write_idx_file(index_name, idx_objects, nr_objects, sha1);
 	free(idx_objects);
 
-- 
1.5.2.0.45.gfea6d-dirty

^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2007-06-06 21:36 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-06-06  9:39 [PATCH] Add git-index-pack -l to list objects in a pack Sam Vilain
2007-06-06 13:55 ` Nicolas Pitre
2007-06-06 21:23   ` Sam Vilain
2007-06-06 21:35     ` Junio C Hamano

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).