use setup_git_directory() in test-* programs

Some of the test-* programs rely on examining refs, but did not bother to make sure we are actually in a git repository. Let's have them call setup_git_directory() to do so. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Jeff King committed Mar 5, 2016 at 17:16 UTC 11e6b3f6d544fd6b2914583749b90b29d1d8683d
2 files changed +4
test-match-trees.c
+2
@@ -6,6 +6,8 @@ int main(int ac, char **av)
6 unsigned char hash1[20], hash2[20], shifted[20];
7 struct tree *one, *two;
8
9 + setup_git_directory();
10 +
11 if (get_sha1(av[1], hash1))
12 die("cannot parse %s as an object name", av[1]);
13 if (get_sha1(av[2], hash2))
test-revision-walking.c
+2
@@ -50,6 +50,8 @@ int main(int argc, char **argv)
50 if (argc < 2)
51 return 1;
52
53 + setup_git_directory();
54 +
55 if (!strcmp(argv[1], "run-twice")) {
56 printf("1st\n");
57 if (!run_revision_walk())