<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -1,5 +1,7 @@
 *SVN*
 
+* For query_revision, git SCM used git-rev-parse on the repo hosting the Capfile, which may NOT be the same tree as the actual source reposistory. Use git-ls-remote instead to resolve the revision for checkout. [Robin H. Johnson]
+
 * Allow :ssh_options hash to be specified per server [Jesse Newland]
 
 * Added support for depend :remote, :file to test for existence of a specific file [Andrew Carter]</diff>
      <filename>CHANGELOG</filename>
    </modified>
    <modified>
      <diff>@@ -192,7 +192,13 @@ module Capistrano
         # Getting the actual commit id, in case we were passed a tag
         # or partial sha or something - it will return the sha if you pass a sha, too
         def query_revision(revision)
-          yield(scm('rev-parse', revision)).chomp
+          return revision if revision =~ /^[0-9a-f]{40}$/
+          command = scm('ls-remote', repository, revision)
+          result = yield(command)
+          revdata = result.split(&quot;\t&quot;)
+          newrev = revdata[0]
+          raise &quot;Unable to resolve revision for #{revision}&quot; unless newrev =~ /^[0-9a-f]{40}$/
+          return newrev
         end
 
         def command</diff>
      <filename>lib/capistrano/recipes/deploy/scm/git.rb</filename>
    </modified>
    <modified>
      <diff>@@ -7,7 +7,7 @@ class DeploySCMGitTest &lt; Test::Unit::TestCase
   end
 
   def setup
-    @config = { }
+    @config = { :repository =&gt; &quot;.&quot; }
     def @config.exists?(name); key?(name); end
 
     @source = TestSCM.new(@config)
@@ -50,7 +50,11 @@ class DeploySCMGitTest &lt; Test::Unit::TestCase
   end
 
   def test_query_revision
-    assert_equal &quot;git rev-parse HEAD&quot;, @source.query_revision('HEAD') { |o| o }
+    revision = @source.query_revision('HEAD') do |o|
+      assert_equal &quot;git ls-remote . HEAD&quot;, o
+      &quot;d11006102c07c94e5d54dd0ee63dca825c93ed61\tHEAD&quot;
+    end
+    assert_equal &quot;d11006102c07c94e5d54dd0ee63dca825c93ed61&quot;, revision
   end
 
   def test_command_should_be_backwards_compatible</diff>
      <filename>test/deploy/scm/git_test.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>d11006102c07c94e5d54dd0ee63dca825c93ed61</id>
    </parent>
  </parents>
  <author>
    <name>Jamis Buck</name>
    <email>jamis@37signals.com</email>
  </author>
  <url>http://github.com/jamis/capistrano/commit/ec9a7fa52c9f417a9a01a7e764b520be1ec32c5c</url>
  <id>ec9a7fa52c9f417a9a01a7e764b520be1ec32c5c</id>
  <committed-date>2008-04-24T21:37:02-07:00</committed-date>
  <authored-date>2008-04-24T21:37:02-07:00</authored-date>
  <message>Use correct source for query_revision [#4 tagged:committed state:resolved]</message>
  <tree>5d4923fd42a60cb46d398fc44384998628f6c562</tree>
  <committer>
    <name>Jamis Buck</name>
    <email>jamis@37signals.com</email>
  </committer>
</commit>
