jonlives/knife-spork — pull request #8 by nickmarden (2012-06-07 23:58:50+00:00)
Title: Play nice with submodules

I ran into a problem where ironfan and knife-spork were not playing nice together. Specifically, the 'git submodule foreach git pull' command was failing thusly:

[nick@machine ironfan-homebase] (master)$ bundle exec knife spork bump mycookbook

Loaded config file /Users/nick/.chef/spork-config.yml...

Opening git repo /Users/nick/workspace/ironfan-homebase/

Pulling latest changes from git

Current branch master is up to date.

Pulling latest changes from git submodules (if any)

ERROR: Entering 'cookbooks/user'
Current branch master is up to date.
Entering 'notes'
Current branch master is up to date.
Entering 'vendor/ironfan-pantry'
You are not currently on a branch, so I cannot use any
'branch..merge' in your configuration file.
Please specify which branch you want to merge with on the command
line and try again (e.g. 'git pull ').
See git-pull(1) for details.

I think the attached patch fixes this, by using "git pull --recurse-submodules" to fetch submodule changes, and "git submodule update" to update the submodules that have been pulled.

Of course, I may have misunderstood something - feel free to let me know if that's the case.