summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 291ec0f)
raw | patch | inline | side by side (parent: 291ec0f)
author | Linus Torvalds <torvalds@g5.osdl.org> | |
Wed, 6 Jul 2005 00:08:02 +0000 (17:08 -0700) | ||
committer | Linus Torvalds <torvalds@g5.osdl.org> | |
Wed, 6 Jul 2005 00:08:02 +0000 (17:08 -0700) |
This was invaluable for debugging the zero-sized compression issue, and
might be useful for scripting too, if people want to see the contents of
a pack.
might be useful for scripting too, if people want to see the contents of
a pack.
Makefile | patch | blob | history | |
show-index.c | [new file with mode: 0644] | patch | blob |
diff --git a/Makefile b/Makefile
index 877d10b18d394f366c033295bab203df7c3f1068..5dcfc24f892b92f5adcbbc8396d48de565309538 100644 (file)
--- a/Makefile
+++ b/Makefile
git-get-tar-commit-id git-apply git-stripspace \
git-diff-stages git-rev-parse git-patch-id git-pack-objects \
git-unpack-objects git-verify-pack git-receive-pack git-send-pack \
- git-prune-packed git-fetch-pack git-upload-pack git-clone-pack
+ git-prune-packed git-fetch-pack git-upload-pack git-clone-pack \
+ git-show-index
all: $(PROG)
diff --git a/show-index.c b/show-index.c
--- /dev/null
+++ b/show-index.c
@@ -0,0 +1,28 @@
+#include "cache.h"
+
+int main(int argc, char **argv)
+{
+ int i;
+ unsigned nr;
+ unsigned int entry[6];
+ static unsigned int top_index[256];
+
+ if (fread(top_index, sizeof(top_index), 1, stdin) != 1)
+ die("unable to read idex");
+ nr = 0;
+ for (i = 0; i < 256; i++) {
+ unsigned n = ntohl(top_index[i]);
+ if (n < nr)
+ die("corrupt index file");
+ nr = n;
+ }
+ for (i = 0; i < nr; i++) {
+ unsigned offset;
+
+ if (fread(entry, 24, 1, stdin) != 1)
+ die("unable to read entry %u/%u", i, nr);
+ offset = ntohl(entry[0]);
+ printf("%u %s\n", offset, sha1_to_hex((void *)(entry+1)));
+ }
+ return 0;
+}