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

* Re: [PATCH] Add git-index-pack -l to list objects in a pack
  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
  0 siblings, 1 reply; 4+ messages in thread
From: Nicolas Pitre @ 2007-06-06 13:55 UTC (permalink / raw)
  To: Sam Vilain; +Cc: Junio C Hamano, git

On Wed, 6 Jun 2007, Sam Vilain wrote:

> 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

Why don't you simply use git-show-index?


Nicolas

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

* Re: [PATCH] Add git-index-pack -l to list objects in a pack
  2007-06-06 13:55 ` Nicolas Pitre
@ 2007-06-06 21:23   ` Sam Vilain
  2007-06-06 21:35     ` Junio C Hamano
  0 siblings, 1 reply; 4+ messages in thread
From: Sam Vilain @ 2007-06-06 21:23 UTC (permalink / raw)
  To: Nicolas Pitre; +Cc: Junio C Hamano, git

Nicolas Pitre wrote:
>> 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
> 
> Why don't you simply use git-show-index?

Because I found the enticing -n switch in the documentation first?

That command certainly would have done the trick for what I needed it
to do.  Perhaps change the documentation of the switch?

Subject: [PATCH] fix documentation of unpack-objects -n

unpack-objects -n didn't print the object list as promised on the
manual page, so alter the documentation to reflect the behaviour
---
 Documentation/git-unpack-objects.txt |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/Documentation/git-unpack-objects.txt b/Documentation/git-unpack-objects.txt
index ff6184b..b1b3ec9 100644
--- a/Documentation/git-unpack-objects.txt
+++ b/Documentation/git-unpack-objects.txt
@@ -27,8 +27,8 @@ new packs and replace existing ones.
 OPTIONS
 -------
 -n::
-        Only list the objects that would be unpacked, don't actually unpack
-        them.
+        Dry run.  Check the pack file without actually unpacking
+	the objects.
 
 -q::
 	The command usually shows percentage progress.  This
-- 
1.5.2.0.45.gfea6d-dirty

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

* Re: [PATCH] Add git-index-pack -l to list objects in a pack
  2007-06-06 21:23   ` Sam Vilain
@ 2007-06-06 21:35     ` Junio C Hamano
  0 siblings, 0 replies; 4+ messages in thread
From: Junio C Hamano @ 2007-06-06 21:35 UTC (permalink / raw)
  To: Sam Vilain; +Cc: Nicolas Pitre, git

Sam Vilain <sam.vilain@catalyst.net.nz> writes:

> Nicolas Pitre wrote:
>>> 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
>> 
>> Why don't you simply use git-show-index?
>
> Because I found the enticing -n switch in the documentation first?
>
> That command certainly would have done the trick for what I needed it
> to do.  Perhaps change the documentation of the switch?

I think this is "incorrect expectation".  The document says:

>  -n::
> -        Only list the objects that would be unpacked, don't actually unpack
> -        them.

I suspect that you were trying to unpack in a repository that
already had that object?  They are not "the objects that would
be unpacked" hence not listed.

^ permalink raw reply	[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).