show-index.con commit git-fetch: use fetch--tool pick-rref to avoid local fetch from alternate (e3c6f24)
   1#include "cache.h"
   2
   3int main(int argc, char **argv)
   4{
   5        int i;
   6        unsigned nr;
   7        unsigned int entry[6];
   8        static unsigned int top_index[256];
   9
  10        if (fread(top_index, sizeof(top_index), 1, stdin) != 1)
  11                die("unable to read index");
  12        nr = 0;
  13        for (i = 0; i < 256; i++) {
  14                unsigned n = ntohl(top_index[i]);
  15                if (n < nr)
  16                        die("corrupt index file");
  17                nr = n;
  18        }
  19        for (i = 0; i < nr; i++) {
  20                unsigned offset;
  21
  22                if (fread(entry, 24, 1, stdin) != 1)
  23                        die("unable to read entry %u/%u", i, nr);
  24                offset = ntohl(entry[0]);
  25                printf("%u %s\n", offset, sha1_to_hex((void *)(entry+1)));
  26        }
  27        return 0;
  28}