Permalink
Browse files

Fixed bug where whitespace around revision was breaking git query_rev…

…ision
  • Loading branch information...
1 parent 2187f96 commit 0574db26e085e25877d7be5c732c710b17495282 @snsdigital snsdigital committed Nov 18, 2008
Showing with 9 additions and 1 deletion.
  1. +1 −1 lib/capistrano/recipes/deploy/scm/git.rb
  2. +8 −0 test/deploy/scm/git_test.rb
@@ -216,7 +216,7 @@ def query_revision(revision)
newrev = nil
revdata.each_slice(2) do |refs|
rev, ref = *refs
- if ref.sub(/refs\/.*?\//, '') == revision
+ if ref.sub(/refs\/.*?\//, '').strip == revision
newrev = rev
break
end
@@ -64,6 +64,14 @@ def test_query_revision
end
assert_equal "d11006102c07c94e5d54dd0ee63dca825c93ed61", revision
end
+
+ def test_query_revision_has_whitespace
+ revision = @source.query_revision('HEAD') do |o|
+ assert_equal "git ls-remote . HEAD", o
+ "d11006102c07c94e5d54dd0ee63dca825c93ed61\tHEAD\r"
+ end
+ assert_equal "d11006102c07c94e5d54dd0ee63dca825c93ed61", revision
+ end
def test_query_revision_deprecation_error
assert_raise(ArgumentError) do

0 comments on commit 0574db2

Please sign in to comment.