Unverified Commit 20306d36 by Patrick Steinhardt Committed by GitHub

Merge pull request #4665 from neithernut/fix-refdb-glob

refdb_fs: fix regression: failure when globbing for non-existant references
parents 991bf691 d7eca4c3
......@@ -538,12 +538,16 @@ static int iter_load_loose_paths(refdb_fs_backend *backend, refdb_fs_iter *iter)
}
if ((error = git_buf_printf(&path, "%s/", backend->commonpath)) < 0 ||
(error = git_buf_put(&path, ref_prefix, ref_prefix_len)) < 0 ||
(error = git_iterator_for_filesystem(&fsit, path.ptr, &fsit_opts)) < 0) {
(error = git_buf_put(&path, ref_prefix, ref_prefix_len)) < 0) {
git_buf_free(&path);
return error;
}
if ((error = git_iterator_for_filesystem(&fsit, path.ptr, &fsit_opts)) < 0) {
git_buf_free(&path);
return (iter->glob && error == GIT_ENOTFOUND)? 0 : error;
}
error = git_buf_sets(&path, ref_prefix);
while (!error && !git_iterator_advance(&entry, fsit)) {
......
......@@ -62,6 +62,11 @@ void test_refs_foreachglob__retrieve_local_branches(void)
assert_retrieval("refs/heads/*", 12);
}
void test_refs_foreachglob__retrieve_nonexistant(void)
{
assert_retrieval("refs/nonexistent/*", 0);
}
void test_refs_foreachglob__retrieve_partially_named_references(void)
{
/*
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment