git-subrepo
git-subrepo copied to clipboard
Push: git-subrepo: Command failed: .... fatal: Not a valid object name: ''.
I'm not sure where to begin debugging this.... please let me know if you require additional output
$ git subrepo --version
0.4.1
The command:
$ git subrepo push packer/cookbooks/kfchub -vd
>>> git rev-parse --verify HEAD
* Assert that working copy is clean: /home/<redacted>/src/kfchub.tf
* Check for worktree with branch subrepo/packer/cookbooks/kfchub
* Fetch the upstream: https://github.com/bbros-dev/kfchub.chef.git (main).
>>> git fetch --no-tags --quiet https://github.com/bbros-dev/kfchub.chef.git main
* Get the upstream subrepo HEAD commit.
>>> git rev-parse FETCH_HEAD^0
* Create ref 'refs/subrepo/packer/cookbooks/kfchub/fetch'.
>>> git update-ref refs/subrepo/packer/cookbooks/kfchub/fetch dac0eec36208043a74dacdfa84031bea1270a949
* Check upstream head against .gitrepo commit.
* Deleting old 'subrepo/packer/cookbooks/kfchub' branch.
* Remove worktree:
>>> git branch -D subrepo/packer/cookbooks/kfchub
* Create subrepo branch 'subrepo/packer/cookbooks/kfchub'.
* Check if the 'subrepo/packer/cookbooks/kfchub' branch already exists.
* Subrepo parent: 3b93996006b726904247b9b39c98f42c01110cc3
* Create new commits with parents into the subrepo fetch
>>> git rev-list --reverse --ancestry-path --topo-order 3b93996006b726904247b9b39c98f42c01110cc3..HEAD
* Create branch 'subrepo/packer/cookbooks/kfchub' for this new commit set .
>>> git branch subrepo/packer/cookbooks/kfchub
git-subrepo: Command failed: 'git branch subrepo/packer/cookbooks/kfchub '.
fatal: Not a valid object name: ''.
Most common question. We have some slightly better error messages on the release/0.4.2. At the root you either rebased or squash merged at some time. This has caused the parent value in your .gitrepo file to be out of sync with your repository. Update that to the SHA before a local change occurred. That should get you up and running again.
Most common question.
Maybe leave this as a documentation issue? Unless I missed it in the docs?
Exactly the same issue here while executing git subrepo pull --all -vd using the latest version:
>>> git branch subrepo/libs/viewer
git-subrepo: Command failed: 'git branch subrepo/libs/viewer '.
fatal: Not a valid object name: ''.
$ git subrepo --version
0.4.3
Got it fixed now. I did some rebasing which caused the parent value to be out of sync, as described above.
Most common question. We have some slightly better error messages on the release/0.4.2.
I'm using the latest version and still get the same error.
At the root you either rebased or squash merged at some time.
I rebase the main repository all the time, every day if things go well.
This has caused the parent value in your .gitrepo file to be out of sync with your repository.
I see "parent = [sha]" in the subrepo's .gitrep .. This is clear..
Update that to the SHA before a local change occurred. That should get you up and running again.
Can you please clarify this? "SHA before the local change" .. Is that the SHA before the 1st change I need to push to the remote repository? What are the commands you use? Should I just git log path/to/mysubrepo and compare that with the server and get one of the SHAs from my local history?
Can you please clarify this? "SHA before the local change" .. Is that the SHA before the 1st change I need to push to the remote repository? What are the commands you use? Should I just git log path/to/mysubrepo and compare that with the server and get one of the SHAs from my local history?
curious in this as well...
I do squash-merge regularly for PRs. What's the strategy here to ensure subrepo's consistency? (preferrably, not pushing .gitrepo commit to master after merge).