I have a project that contains a submodule which is necessary for a successful build. I am unable to use tod because it only pushes the main repository and does nothing with submodules.
I can think of the following solutions:
Try to also make commits for submodules that it has the ability to also push upstream, and fall back to another option if it can't (no permissions, remote missing, etc.). You could easily test this by trying to make an empty commit and pushing it to the repo, unless there is a better way.
Create a temporary Git repository on the OneDev server to hold the submodule, and push a single commit containing the working tree changes.
Copy the contents of the submodules into the main project and remove the submodule before committing. This is the easiest option but also the least compatible, as Git operations performed in the job that attempt to work on the submodule will fail.
On modern versions of Git, this can be accomplished by a single command: git rm --staged '<submodule-path>'. This will remove the gitlink from the index and the submodule's section from .gitmodules, without removing the working tree files or the .git/modules local repository, and it will also set the submodule to inactive in .git/config.
Also, having submodule.recurse or push.recurseSubmodules Git configs enabled results in errors when tod tries to push to the remote. These (and maybe other) options should be disabled for tod-run Git commands.
I have a project that contains a submodule which is necessary for a successful build. I am unable to use
todbecause it only pushes the main repository and does nothing with submodules.I can think of the following solutions:
git rm --staged '<submodule-path>'. This will remove thegitlinkfrom the index and the submodule's section from.gitmodules, without removing the working tree files or the.git/moduleslocal repository, and it will also set the submodule to inactive in.git/config.Also, having
submodule.recurseorpush.recurseSubmodulesGit configs enabled results in errors whentodtries to push to the remote. These (and maybe other) options should be disabled fortod-run Git commands.