diff options
author | Patrick Steinhardt <ps@pks.im> | 2016-08-30 08:22:17 +0200 |
---|---|---|
committer | Patrick Steinhardt <ps@pks.im> | 2016-08-30 08:22:49 +0200 |
commit | a08e88259fe7ef3d7514a4774acd6eec5a6a2ca7 (patch) | |
tree | f98363732485f5a3abe33debef803880f2762b53 | |
parent | dfd7957696eed03733d8edb17e132153c7dc7a4e (diff) | |
parent | 88cfe61497dbf1f568e1c606f8b1c791602c71f4 (diff) | |
download | libgit2-a08e88259fe7ef3d7514a4774acd6eec5a6a2ca7.tar.gz |
Merge pull request #3907 from steffhip/git_checkout_tree-fix
-rw-r--r-- | src/checkout.c | 2 | ||||
-rw-r--r-- | tests/checkout/tree.c | 4 |
2 files changed, 5 insertions, 1 deletions
diff --git a/src/checkout.c b/src/checkout.c index 72ee8b624..f11102c8b 100644 --- a/src/checkout.c +++ b/src/checkout.c @@ -2722,7 +2722,7 @@ int git_checkout_tree( if ((error = git_repository_index(&index, repo)) < 0) return error; - if ((opts->checkout_strategy & GIT_CHECKOUT_DISABLE_PATHSPEC_MATCH)) { + if (opts && (opts->checkout_strategy & GIT_CHECKOUT_DISABLE_PATHSPEC_MATCH)) { iter_opts.pathlist.count = opts->paths.count; iter_opts.pathlist.strings = opts->paths.strings; } diff --git a/tests/checkout/tree.c b/tests/checkout/tree.c index 7df4d7ef0..4a0314a9e 100644 --- a/tests/checkout/tree.c +++ b/tests/checkout/tree.c @@ -1479,3 +1479,7 @@ void test_checkout_tree__baseline_is_empty_when_no_index(void) git_reference_free(head); } +void test_checkout_tree__nullopts(void) +{ + cl_git_pass(git_checkout_tree(g_repo, NULL, NULL)); +} |