Skip to content

Commit

Permalink
Revert "Strip trailing whitespace for scm fetch_revision"
Browse files Browse the repository at this point in the history
This reverts commit ad8682d. The original change to SSHKit which made stripping necessary was reverted in capistrano/sshkit#249, so we no longer need to strip in capistrano.
  • Loading branch information
robd committed May 26, 2015
1 parent ad61d92 commit 091dee0
Show file tree
Hide file tree
Showing 7 changed files with 10 additions and 9 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ https://github.com/capistrano/capistrano/compare/v3.4.0...HEAD
* Added options to set username and password when using Subversion as SCM (@dsthode)
* Allow after() to refer to tasks that have not been loaded yet (@jcoglan)
* Ensure scm fetch_revision methods strip trailing whitespace (@mattbrictson)
* Reverted due to [SSHKit PR249](https://github.com/capistrano/sshkit/pull/249) (@robd)
* Allow use "all" as string for server filtering (@theist)

## `3.4.0`
Expand Down
2 changes: 1 addition & 1 deletion lib/capistrano/git.rb
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ def release
end

def fetch_revision
context.capture(:git, "rev-list --max-count=1 --abbrev-commit #{fetch(:branch)}").strip
context.capture(:git, "rev-list --max-count=1 --abbrev-commit #{fetch(:branch)}")
end
end
end
2 changes: 1 addition & 1 deletion lib/capistrano/hg.rb
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ def release
end

def fetch_revision
context.capture(:hg, "log --rev #{fetch(:branch)} --template \"{node}\n\"").strip
context.capture(:hg, "log --rev #{fetch(:branch)} --template \"{node}\n\"")
end
end
end
2 changes: 1 addition & 1 deletion lib/capistrano/svn.rb
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ def release
end

def fetch_revision
context.capture(:svnversion, repo_path).strip
context.capture(:svnversion, repo_path)
end
end
end
4 changes: 2 additions & 2 deletions spec/lib/capistrano/git_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,9 @@ module Capistrano
end

describe "#fetch_revision" do
it "should strip trailing whitespace" do
it "should capture git rev-list" do
context.expects(:fetch).with(:branch).returns(:branch)
context.expects(:capture).with(:git, "rev-list --max-count=1 --abbrev-commit branch").returns("01abcde\n")
context.expects(:capture).with(:git, "rev-list --max-count=1 --abbrev-commit branch").returns("01abcde")
revision = subject.fetch_revision
expect(revision).to eq("01abcde")
end
Expand Down
4 changes: 2 additions & 2 deletions spec/lib/capistrano/hg_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,9 @@ module Capistrano
end

describe "#fetch_revision" do
it "should strip trailing whitespace" do
it "should capture hg log" do
context.expects(:fetch).with(:branch).returns(:branch)
context.expects(:capture).with(:hg, "log --rev branch --template \"{node}\n\"").returns("01abcde\n")
context.expects(:capture).with(:hg, "log --rev branch --template \"{node}\n\"").returns("01abcde")
revision = subject.fetch_revision
expect(revision).to eq("01abcde")
end
Expand Down
4 changes: 2 additions & 2 deletions spec/lib/capistrano/svn_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -77,10 +77,10 @@ module Capistrano
end

describe "#fetch_revision" do
it "should run fetch revision and strip trailing whitespace" do
it "should capture svn version" do
context.expects(:repo_path).returns(:path)

context.expects(:capture).with(:svnversion, :path).returns("12345\n")
context.expects(:capture).with(:svnversion, :path).returns("12345")

revision = subject.fetch_revision
expect(revision).to eq("12345")
Expand Down

0 comments on commit 091dee0

Please sign in to comment.