The ref subsystem has not been migrated yet to access the object store
via passed in repository objects. As a result replace when the object store
tries to access replace refs in a repository other than the_repository
it produces errors:

  error: refs/replace/3afabef75c627b894cccc3bcae86837abc7c32fe does not point 
to a valid object!

Add a test demonstrating this failure.

Signed-off-by: Jonathan Nieder <jrnie...@gmail.com>
Signed-off-by: Stefan Beller <sbel...@google.com>

squash! push: add test showing bad interaction of replace refs and submodules

replace-objects: evaluate replacement refs without using the object store

Pass DO_FOR_EACH_INCLUDE_BROKEN when iterating over replacement refs
so that the iteration does not require opening the named objects from
the object store. This avoids a dependency cycle between object access
and replace ref iteration.

Moreover the ref subsystem has not been migrated yet to access the object
store via passed in repository objects.  As a result, without this patch
when the object store tries to access replace refs in a repository other
than the_repository it produces errors:

   error: refs/replace/3afabef75c627b894cccc3bcae86837abc7c32fe does not point 
to a valid object!

Signed-off-by: Jonathan Nieder <jrnie...@gmail.com>
Signed-off-by: Stefan Beller <sbel...@google.com>
---
 t/t5531-deep-submodule-push.sh | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/t/t5531-deep-submodule-push.sh b/t/t5531-deep-submodule-push.sh
index 39cb2c1c34..8b2aa5a0f4 100755
--- a/t/t5531-deep-submodule-push.sh
+++ b/t/t5531-deep-submodule-push.sh
@@ -308,6 +308,22 @@ test_expect_success 'submodule entry pointing at a tag is 
error' '
        test_i18ngrep "is a tag, not a commit" err
 '
 
+test_expect_success 'replace ref does not interfere with submodule access' '
+       test_commit -C work/gar/bage one &&
+       test_commit -C work/gar/bage two &&
+       git -C work/gar/bage reset HEAD^^ &&
+       git -C work/gar/bage replace two one &&
+       test_when_finished "git -C work/gar/bage replace -d two" &&
+
+       test_commit -C work/gar/bage three &&
+       git -C work add gar/bage &&
+       git -C work commit -m "advance submodule" &&
+
+       git -C work push --recurse-submodules=on-demand ../pub.git master 2>err 
&&
+       ! grep error err &&
+       ! grep fatal err
+'
+
 test_expect_success 'push fails if recurse submodules option passed as yes' '
        (
                cd work/gar/bage &&
-- 
2.15.1.433.g936d1b9894.dirty

Reply via email to