Skip to content

Commit e265eb2

Browse files
committed
tests: show errors when libgit2_init fails
1 parent 5158b0b commit e265eb2

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

tests/main.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,9 @@ int main(int argc, char *argv[])
1818

1919
res = git_libgit2_init();
2020
if (res < 0) {
21-
fprintf(stderr, "failed to init libgit2");
21+
const git_error *err = git_error_last();
22+
const char *msg = err ? err->message : "unknown failure";
23+
fprintf(stderr, "failed to init libgit2: %s\n", msg);
2224
return res;
2325
}
2426

0 commit comments

Comments
 (0)