Apparent interaction between recursive submodule push and self-submodules

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Thank you for filling out a Git bug report!
Please answer the following questions to help us understand your issue.

What did you do before the bug happened? (Steps to reproduce your issue)

In your .gitconfig, have
  [submodule]
	recurse = true

Then follow this script:

```
$ mkdir x
$ cd x; git init
Initialized empty Git repository in /private/tmp/x/.git/
$ touch a
$ git add a
$ git commit -m 'initial'
[main (root-commit) 0afd184] initial
 1 file changed, 0 insertions(+), 0 deletions(-)
 create mode 100644 a
$ cd ..
$ git clone x y
Cloning into 'y'...
done.
$ cd y
$ git branch -c b
$ git submodule add ../x self
Cloning into '/private/tmp/y/self'...
done.
$ git submodule update --init
$ git push origin HEAD:refs/heads/b
Total 0 (delta 0), reused 0 (delta 0), pack-reused 0
To /private/tmp/x
 * [new branch]      HEAD -> b
$ cd self
$ echo 'first change' >> a
$ git commit -a -m 'first change on main'
[main 80466da] first change on main
 1 file changed, 1 insertion(+)
$ cd ..
$ git add .gitmodules self
$ git commit -m 'update to point at new submodule'
[main 4f5a1b7] update to point at new submodule
 2 files changed, 4 insertions(+)
 create mode 100644 .gitmodules
 create mode 160000 self
$ git push origin HEAD:b
Pushing submodule 'self'
Enumerating objects: 5, done.
Counting objects: 100% (5/5), done.
Writing objects: 100% (3/3), 252 bytes | 252.00 KiB/s, done.
Total 3 (delta 0), reused 0 (delta 0), pack-reused 0
To /private/tmp/x
   0afd184..80466da  HEAD -> b
Enumerating objects: 4, done.
Counting objects: 100% (4/4), done.
Delta compression using up to 10 threads
Compressing objects: 100% (2/2), done.
Writing objects: 100% (3/3), 357 bytes | 357.00 KiB/s, done.
Total 3 (delta 0), reused 0 (delta 0), pack-reused 0
remote: error: cannot lock ref 'refs/heads/b': is at 80466da48f71630dc87553ca75e216cf6f1dfda9 but expected 0afd18466f353590ae52219e32a712691a59b60b
To /private/tmp/x
 ! [remote rejected] HEAD -> b (failed to update ref)
error: failed to push some refs to '/private/tmp/x'
$
```

What did you expect to happen? (Expected behavior)

No error

What happened instead? (Actual behavior)

See error above.

What's different between what you expected and what actually happened?

Anything else you want to add:

If I do this with a repository cloned via ssh and a submodule cloned via https,
I get a different error:

```
$ git push -v origin refs/heads/gh-pages\:refs/heads/gh-pages
Pushing to github.com:stlab/adobe-reveal-theme
fatal: bad object f7cc6f9014af46fb9cfcaae26b82ac830593df6d
error: remote unpack failed: eof before pack header was fully read
To github.com:stlab/adobe-reveal-theme
 ! [remote rejected] gh-pages -> gh-pages (failed)
error: failed to push some refs to 'github.com:stlab/adobe-reveal-theme'
```

The issue appears to be an interaction between recursive submodule push and the fact
that the submodule comes from the same repository as its super-module.

[System Info]
git version:
git version 2.32.0 (Apple Git-132)
cpu: arm64
no commit associated with this build
sizeof-long: 8
sizeof-size_t: 8
shell-path: /bin/sh
uname: Darwin 21.2.0 Darwin Kernel Version 21.2.0: Sun Nov 28 20:28:41 PST 2021; root:xnu-8019.61.5~1/RELEASE_ARM64_T6000 arm64
compiler info: clang: 13.0.0 (clang-1300.0.29.30)
libc info: no libc information available
$SHELL (typically, interactive shell): /bin/zsh


[Enabled Hooks]
not run from a git repository - no hooks to show





[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux