The current Git module for Capistrano works great if you are working from a central Git repository. However, Git is a distributed source control system. The Git module still works in a distributed environment, but there are some shortcomings. You can no longer use the remote_cache deployment strategy.
This patch modifies the Git module to work better when using the remote_cache deployment strategy in a distributed development model.
The patch adds a :remote variable that when set causes the remote_cache git repository to track a new remote repository. Changes will be fetched from that new remote and merged into the deploy branch. The patch contains modified comments that explain the usage of this new variable along with updated tests.
In order to make this work properly, I had to change the behavior of both the checkout and sync methods. They both now used the passed in revision instead of looking up the head (:branch) directly from the configuration. This means that the full SHA1 commit id, obtained by the query_revision method, is used on the remote server.
This has only one caveat that I've discovered. Users of this module must make sure that the repository they plan to pull from on the remote server contains the commit they plan to pull down. I think this is a perfectly reasonable expectation, but it could cause some confusion if a user has local commits that they wish to deploy but have forgotten to push those commits out.
Using the full SHA1 commit id also fixes a bug when using the :shallow_clone option. When you use the --depth flag, git does not copy down any of the tag references. So if you were using the :shallow_clone option and you wanted to deploy from a specific tag (set :branch, 'v2.0.3') git would complain about not being able to find that commit and your deployment would consequently fail.