Skip to content

Commit 11e6b3f

Browse files
peffgitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 85975c0 commit 11e6b3f

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

test-match-trees.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ int main(int ac, char **av)
66
unsigned char hash1[20], hash2[20], shifted[20];
77
struct tree *one, *two;
88

9+
setup_git_directory();
10+
911
if (get_sha1(av[1], hash1))
1012
die("cannot parse %s as an object name", av[1]);
1113
if (get_sha1(av[2], hash2))

test-revision-walking.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,8 @@ int main(int argc, char **argv)
5050
if (argc < 2)
5151
return 1;
5252

53+
setup_git_directory();
54+
5355
if (!strcmp(argv[1], "run-twice")) {
5456
printf("1st\n");
5557
if (!run_revision_walk())

0 commit comments

Comments
 (0)