Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit a08e882

Browse files
committed
Merge pull request libgit2#3907 from steffhip/git_checkout_tree-fix
2 parents dfd7957 + 88cfe61 commit a08e882

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

src/checkout.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2722,7 +2722,7 @@ int git_checkout_tree(
27222722
if ((error = git_repository_index(&index, repo)) < 0)
27232723
return error;
27242724

2725-
if ((opts->checkout_strategy & GIT_CHECKOUT_DISABLE_PATHSPEC_MATCH)) {
2725+
if (opts && (opts->checkout_strategy & GIT_CHECKOUT_DISABLE_PATHSPEC_MATCH)) {
27262726
iter_opts.pathlist.count = opts->paths.count;
27272727
iter_opts.pathlist.strings = opts->paths.strings;
27282728
}

tests/checkout/tree.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1479,3 +1479,7 @@ void test_checkout_tree__baseline_is_empty_when_no_index(void)
14791479
git_reference_free(head);
14801480
}
14811481

1482+
void test_checkout_tree__nullopts(void)
1483+
{
1484+
cl_git_pass(git_checkout_tree(g_repo, NULL, NULL));
1485+
}

0 commit comments

Comments
 (0)