Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Add test-index-version

Commit 06aaaa0 may step index format
version up and down, depends on whether extended flags present in the
index. This adds a test to check for index format version.

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
  • Loading branch information...
commit dbd57f99680eac33626d5058459efd7f118f5170 1 parent 83b327b
Nguyễn Thái Ngọc Duy authored August 20, 2009 gitster committed August 23, 2009
1  .gitignore
@@ -153,6 +153,7 @@ test-date
153 153
 test-delta
154 154
 test-dump-cache-tree
155 155
 test-genrandom
  156
+test-index-version
156 157
 test-match-trees
157 158
 test-parse-options
158 159
 test-path-utils
1  Makefile
@@ -1580,6 +1580,7 @@ TEST_PROGRAMS += test-parse-options$X
1580 1580
 TEST_PROGRAMS += test-path-utils$X
1581 1581
 TEST_PROGRAMS += test-sha1$X
1582 1582
 TEST_PROGRAMS += test-sigchain$X
  1583
+TEST_PROGRAMS += test-index-version$X
1583 1584
 
1584 1585
 all:: $(TEST_PROGRAMS)
1585 1586
 
14  test-index-version.c
... ...
@@ -0,0 +1,14 @@
  1
+#include "cache.h"
  2
+
  3
+int main(int argc, const char **argv)
  4
+{
  5
+	struct cache_header hdr;
  6
+	int version;
  7
+
  8
+	memset(&hdr,0,sizeof(hdr));
  9
+	if (read(0, &hdr, sizeof(hdr)) != sizeof(hdr))
  10
+		return 0;
  11
+	version = ntohl(hdr.hdr_version);
  12
+	printf("%d\n", version);
  13
+	return 0;
  14
+}

0 notes on commit dbd57f9

Please sign in to comment.
Something went wrong with that request. Please try again.