]> git.ipfire.org Git - thirdparty/git.git/blobdiff - refs/reftable-backend.c
Merge branch 'ps/reftable-repo-init-fix'
[thirdparty/git.git] / refs / reftable-backend.c
index 6c11c4a5e334f8c6ef64d1632956117a870869eb..2c88bbd448b18785200a83b7a9e4e794cc364d60 100644 (file)
@@ -364,12 +364,15 @@ static int reftable_ref_iterator_advance(struct ref_iterator *ref_iterator)
                        break;
 
                /*
-                * The files backend only lists references contained in
-                * "refs/". We emulate the same behaviour here and thus skip
-                * all references that don't start with this prefix.
+                * The files backend only lists references contained in "refs/" unless
+                * the root refs are to be included. We emulate the same behaviour here.
                 */
-               if (!starts_with(iter->ref.refname, "refs/"))
+               if (!starts_with(iter->ref.refname, "refs/") &&
+                   !(iter->flags & DO_FOR_EACH_INCLUDE_ROOT_REFS &&
+                    (is_pseudoref(&iter->refs->base, iter->ref.refname) ||
+                     is_headref(&iter->refs->base, iter->ref.refname)))) {
                        continue;
+               }
 
                if (iter->prefix &&
                    strncmp(iter->prefix, iter->ref.refname, strlen(iter->prefix))) {
@@ -778,6 +781,7 @@ static int reftable_be_transaction_prepare(struct ref_store *ref_store,
                                      &head_referent, &head_type);
        if (ret < 0)
                goto done;
+       ret = 0;
 
        for (i = 0; i < transaction->nr; i++) {
                struct ref_update *u = transaction->updates[i];