I am working on setting up vagrant + chef + magento and found an open source solution that was very close to what I needed. I forked a repository which uses submodules. I also forked one of the submodules. I made changes to this submodule as well as the main repo and pushed back to my forks of each. One of the changes to my fork of the main repo was to the .gitmodules file, in an effort to ensure my forked submodule would be used by my forked main project. This link is somehow incorrect as the original submodule is pulled every time instead of my fork.
.gitmodules
[submodule "recipes/cookbooks/vagrant_magento"]
path = recipes/cookbooks/vagrant_magento
url = https://github.com/HexArmor/vagrant_magento
I used this SO answer as well as this SO question as my troubleshooting guides. Following the various answers in each proved unsuccessful.
Looking at the specific submodule section of my fork's git repo appears to prove I have linked these correctly. Clicking on vagrant_magento or the included reference tag both land you on my submodules fork which is what I want to be used here. Yet this page says it has not been updated in over a year, which confuses me and pull down the repo and running git submodule update --init
still pulls in the old submodule.
Any help would be greatly appreciated, thanks!
It doesn't look like you ever committed the changes to the submodule in your superproject.
me@myvm:/scratch/vagrant-magento-vm/recipes (master)$ git submodule status
6be892d5efb2050ed432ee1f71dab067343fcfd0 cookbooks/vagrant_magento (6be892d)
6be is two behind your changes, and points to one of the original commits.
cd to the submodule
me@myvm:/scratch/vagrant-magento-vm (master)$ cd recipes/cookbooks/vagrant_magento/
How precisely you specify the newer version is up to you. Submodules used to only track SHAs, but recently they can track branches as well.
me@myvm:/scratch/vagrant-magento-vm/recipes/cookbooks/vagrant_magento ((6be892d...))$ git checkout master
Previous HEAD position was 6be892d... adds n98-magerun amazing shell script to installation
Switched to branch 'master'
Your branch is up-to-date with 'origin/master'.
me@myvm:/scratch/vagrant-magento-vm/recipes/cookbooks/vagrant_magento (master)$ git log --oneline -3
b9be44a update version
489b6e4 changes to update to magento 1.9.0.0
6be892d adds n98-magerun amazing shell script to installation
Now go back to the super project and register the changes there
me@myvm:/scratch/vagrant-magento-vm/recipes/cookbooks (master)$ cd ../../
me@myvm:/scratch/vagrant-magento-vm (master)$ git status
On branch master
Your branch is up-to-date with 'origin/master'.
Changes not staged for commit:
(use "git add <file>..." to update what will be committed)
(use "git checkout -- <file>..." to discard changes in working directory)
modified: recipes/cookbooks/vagrant_magento (new commits)
Submodules changed but not updated:
* recipes/cookbooks/vagrant_magento 6be892d...b9be44a (2):
> update version
no changes added to commit (use "git add" and/or "git commit -a")
me@myvm:/scratch/vagrant-magento-vm (master)$ git add recipes/cookbooks/vagrant_magento
and final result
me@myvm:/scratch/vagrant-magento-vm (master)$ git commit -m "update submodule"
[master 57be259] update submodule
1 file changed, 1 insertion(+), 1 deletion(-)
me@myvm:/scratch/vagrant-magento-vm (master)$ git submodule status
fca9af50217493f120706871719f5f88ad0c6082 recipes/cookbooks/apache2 (1.6.2-5-gfca9af5)
ea834265247cc8b507ac37ab3a34a9b44ed27a11 recipes/cookbooks/apt (1.7.0)
df4264aad07d706f3207cb1fe2bbfa03a0b82f31 recipes/cookbooks/build-essential (1.4.0-2-gdf4264a)
a702e254833cac60b3f1fbc3ae098850b40572d7 recipes/cookbooks/chef_handler (1.1.4)
8f31c451d1b090165c758d37b2d4a78a533ccf31 recipes/cookbooks/database (1.4.0-1-g8f31c45)
5860dd00c470f1bdebf42bf369d9da58029ce9f5 recipes/cookbooks/git (2.5.2-1-g5860dd0)
164962228fb3f1f7b95469305347a982e958806d recipes/cookbooks/memcached (1.4.0-1-g1649622)
61bda92b46f2eabd59a8e4c3eef4df8096bcf0dc recipes/cookbooks/mysql (3.0.0-10-g61bda92)
ccf81e9b3fec9427ed2e6dd76f252dcf68370379 recipes/cookbooks/openssl (1.0.2)
6a3056dae96d0a826ddc8f5a8ff392afa61aaafc recipes/cookbooks/php (1.2.0-8-g6a3056d)
124e59194a1fca4563ed1a8dfd517808864a6b90 recipes/cookbooks/runit (1.1.4)
b9be44ad2eba72680980e8846da79c882e50c44c recipes/cookbooks/vagrant_magento (heads/master)
88e8d018267d2cd5cfa3260ce55a0025f52dae6f recipes/cookbooks/vim (v1.1.0~3)
d8b8bf88faf1c07c51d033a9517f04687128e530 recipes/cookbooks/windows (1.9.0-1-gd8b8bf8)
me@myvm:/scratch/vagrant-magento-vm (master)$