git-subrepo
git-subrepo copied to clipboard
Not a valid object name when push dot named subrepo
I used a directory name with a dot '.', which usually can't be used in a branch name,
I tried using git subrepo init
and it worked,
but when I did a git subrepo push
it failed,
guessing because of the dot name , the same git repo branch
also fails.
git-subrepo: Command failed: 'git branch subrepo/%2eseed '.
fatal: Not a valid object name: ''.
git-subrepo Version: 0.4.5
Copyright 2013-2020 Ingy döt Net
https://github.com/ingydotnet/git-subrepo
/home/xy/git-subrepo/lib/git-subrepo
Git Version: 2.30.2
I have the same issue using git subrepo pull
. When I execute the git branch command directly - it works just fine
it looks like it should be resolved by PR https://github.com/ingydotnet/git-subrepo/pull/498
After re-init and clone, I found that it was actually because the rebase changed the commit id and the .gitrepo file not same.
Work around? I rebased the master branch and I can push one subrepo, but 3 other nested subrepo's under that one all fail with this error. All subrepos are in rebase mode.
related: https://github.com/ingydotnet/git-subrepo/issues/503#issuecomment-1595365110
Workaround
- commit all changes
- create a branch:
git checkout -b subrepo-fix
- delete subrepo:
rm -rf subrepo/
- re-clone:
git subrepo clone [email protected]:org/subrepo.git subrepo/
- Check for differences in repo state:
git diff main
(optimally, onlysubrepo/.gitrepo
is different)
If you had changes in the parent repo that are not reset to subrepo state
Reset the files to the state on the main branch: git checkout main -- subrepo/file.txt
(be sure not to reset .gitrepo
)
Example: my MR
I found a potential fix for this issue here: https://github.com/ingydotnet/git-subrepo/issues/617