]> git.ipfire.org Git - thirdparty/git.git/commitdiff
use setup_git_directory() in test-* programs
authorJeff King <peff@peff.net>
Sat, 5 Mar 2016 22:16:50 +0000 (17:16 -0500)
committerJunio C Hamano <gitster@pobox.com>
Mon, 7 Mar 2016 20:27:35 +0000 (12:27 -0800)
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>
test-match-trees.c
test-revision-walking.c

index 109f03e711803251b5b5d06bc42579784a326ba8..4dad7095f10bb324f043ff8132678488b65d4537 100644 (file)
@@ -6,6 +6,8 @@ int main(int ac, char **av)
        unsigned char hash1[20], hash2[20], shifted[20];
        struct tree *one, *two;
 
+       setup_git_directory();
+
        if (get_sha1(av[1], hash1))
                die("cannot parse %s as an object name", av[1]);
        if (get_sha1(av[2], hash2))
index 285f06b7ff262378150be80f2a09b4162ae3a564..3d0313354b3e100fe3624b58c61af7cc7e0f8e7b 100644 (file)
@@ -50,6 +50,8 @@ int main(int argc, char **argv)
        if (argc < 2)
                return 1;
 
+       setup_git_directory();
+
        if (!strcmp(argv[1], "run-twice")) {
                printf("1st\n");
                if (!run_revision_walk())