mattbrictson / tomo

A friendly CLI for deploying Rails apps ✨

Home Page:https://tomo.mattbrictson.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

git:create_release doesn't pull submodule

numbcoder opened this issue · comments

My rails app has a submodule which shared with other projects.

I have tried to migrate from mina to tomo to deploy my rails app, but I found that the git:create_release task doesn't pull the submodule.

Tomo is awesome, thank you!

Hi, thanks for the report!

I'm actually not that familiar with git submodules. Do you have any suggestions on how tomo could support them?

As you can see, tomo's git:create_release task is pretty straightforward. It does a git update to pull the latest commits and then a git archive to copy the contents of the repository to the release directory.

def create_release # rubocop:disable Metrics/AbcSize
remote.chdir(paths.git_repo) do
remote.git("remote update --prune")
end
store_release_info
configure_git_attributes
remote.mkdir_p(paths.release)
remote.chdir(paths.git_repo) do
remote.git(
"archive #{ref.shellescape} | "\
"tar -x -f - -C #{paths.release.shellescape}"
)
end
end

Is there something missing here that is needed to support submodules?

It's very complicated to archive a git repository with submodules since tomo clone with the --mirror option, the git submodule command can not execute in a bare git dir.

In a normal(no-bare) git work tree,this script https://gist.github.com/arteymix/03702e3eb05c2c161a86b49d4626d21f could be used to archive a git repository with submodules.

My PR just use git submodule update --init --recursive --depth=1 to update submodules, It works for me.

Given my lack of familiarity with git submodules, I've decided not to build submodules support into tomo at this time. I appreciate the PR, though!

For a workaround, see: #220 (review)