diff options
author | Russell Belfer <rb@github.com> | 2014-04-02 08:58:48 +0400 |
---|---|---|
committer | Russell Belfer <rb@github.com> | 2014-04-02 08:58:48 +0400 |
commit | d1a0900442a235d8389d968a70b196a1b0f1ab7b (patch) | |
tree | 5514cd5924f5fd723daa8698290c4a2006afe887 /tests/blame | |
parent | f28e4c97b38c1ec60dc6ce6e5306067ad24aeb8e (diff) |
Skip blame libgit2 test if not in libgit2 repo
One blame test replies on being run from within the libgit2
repository to leverage having a longer history to play with, but
some bundled versions of libgit2 don't have the whole libgit2
history. This just skips that test if the repository can't be
opened.
Diffstat (limited to 'tests/blame')
-rw-r--r-- | tests/blame/simple.c | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/tests/blame/simple.c b/tests/blame/simple.c index 11ff4cd19..c0d91058a 100644 --- a/tests/blame/simple.c +++ b/tests/blame/simple.c @@ -135,13 +135,22 @@ void test_blame_simple__trivial_libgit2(void) git_blame_options opts = GIT_BLAME_OPTIONS_INIT; git_object *obj; - cl_git_pass(git_repository_open(&g_repo, cl_fixture("../.."))); + /* If we can't open the libgit2 repo, just skip this test */ + if (git_repository_open(&g_repo, cl_fixture("../..")) < 0) { + giterr_clear(); + return; + } /* This test can't work on a shallow clone */ if (git_repository_is_shallow(g_repo)) return; - cl_git_pass(git_revparse_single(&obj, g_repo, "359fc2d")); + /* If somehow it is not a valid libgit2 repo, just move along */ + if (git_revparse_single(&obj, g_repo, "359fc2d") < 0) { + giterr_clear(); + return; + } + git_oid_cpy(&opts.newest_commit, git_object_id(obj)); git_object_free(obj); |