Add test-index-version
Commit 06aaaa0bf70fe37d198893f4e25fa73b6516f8a9 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>
Nguyễn Thái Ngọc Duy committed
Aug 20, 2009 at 20:46 UTC
dbd57f99680eac33626d5058459efd7f118f5170
3 files changed
+16
.gitignore
+1
@@ -153,6 +153,7 @@ test-date
153
test-delta
154
test-dump-cache-tree
155
test-genrandom
156
+test-index-version
157
test-match-trees
158
test-parse-options
159
test-path-utils
Makefile
+1
@@ -1580,6 +1580,7 @@ TEST_PROGRAMS += test-parse-options$X
1580
TEST_PROGRAMS += test-path-utils$X
1581
TEST_PROGRAMS += test-sha1$X
1582
TEST_PROGRAMS += test-sigchain$X
1583
+TEST_PROGRAMS += test-index-version$X
1584
1585
all:: $(TEST_PROGRAMS)
1586
test-index-version.c
new
+14
@@ -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
+}