Skip to content

Commit ac77d30

Browse files
authored
Merge pull request libgit2#5834 from libgit2/cmn/repo-no-passthrough
repo: remove an inappropriate use of PASSTHROUGH
2 parents d05eda8 + 6591dee commit ac77d30

File tree

1 file changed

+9
-11
lines changed

1 file changed

+9
-11
lines changed

src/repository.c

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2354,21 +2354,19 @@ int git_repository_head_unborn(git_repository *repo)
23542354
return 0;
23552355
}
23562356

2357-
static int at_least_one_cb(const char *refname, void *payload)
2358-
{
2359-
GIT_UNUSED(refname);
2360-
GIT_UNUSED(payload);
2361-
return GIT_PASSTHROUGH;
2362-
}
2363-
23642357
static int repo_contains_no_reference(git_repository *repo)
23652358
{
2366-
int error = git_reference_foreach_name(repo, &at_least_one_cb, NULL);
2359+
git_reference_iterator *iter;
2360+
const char *refname;
2361+
int error;
23672362

2368-
if (error == GIT_PASSTHROUGH)
2369-
return 0;
2363+
if ((error = git_reference_iterator_new(&iter, repo)) < 0)
2364+
return error;
23702365

2371-
if (!error)
2366+
error = git_reference_next_name(&refname, iter);
2367+
git_reference_iterator_free(iter);
2368+
2369+
if (error == GIT_ITEROVER)
23722370
return 1;
23732371

23742372
return error;

0 commit comments

Comments
 (0)