Staging
v0.5.1
https://github.com/git/git
Revision 6bf035f2780bde45682e0edf40e35a150bd83706 authored by Junio C Hamano on 18 March 2007, 21:40:35 UTC, committed by Junio C Hamano on 18 March 2007, 21:43:29 UTC
Signed-off-by: Junio C Hamano <junkio@cox.net>
1 parent 2be08a8
Raw File
Tip revision: 6bf035f2780bde45682e0edf40e35a150bd83706 authored by Junio C Hamano on 18 March 2007, 21:40:35 UTC
GIT 1.5.0.5
Tip revision: 6bf035f
show-index.c
#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 index");
	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;
}
back to top