From 091dee0c7284c1ccb1293da5f7cb8d1173e391e8 Mon Sep 17 00:00:00 2001 From: Rob Dupuis Date: Tue, 26 May 2015 23:12:34 +0100 Subject: [PATCH] Revert "Strip trailing whitespace for scm fetch_revision" This reverts commit ad8682de34ac78ba69da1569fe0fcdfa3014dc6d. The original change to SSHKit which made stripping necessary was reverted in https://github.com/capistrano/sshkit/pull/249, so we no longer need to strip in capistrano. --- CHANGELOG.md | 1 + lib/capistrano/git.rb | 2 +- lib/capistrano/hg.rb | 2 +- lib/capistrano/svn.rb | 2 +- spec/lib/capistrano/git_spec.rb | 4 ++-- spec/lib/capistrano/hg_spec.rb | 4 ++-- spec/lib/capistrano/svn_spec.rb | 4 ++-- 7 files changed, 10 insertions(+), 9 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 22e36cfce..428de59c7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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` diff --git a/lib/capistrano/git.rb b/lib/capistrano/git.rb index 0df20efde..3a6727a94 100644 --- a/lib/capistrano/git.rb +++ b/lib/capistrano/git.rb @@ -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 diff --git a/lib/capistrano/hg.rb b/lib/capistrano/hg.rb index 0ac6ae167..e7f029093 100644 --- a/lib/capistrano/hg.rb +++ b/lib/capistrano/hg.rb @@ -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 diff --git a/lib/capistrano/svn.rb b/lib/capistrano/svn.rb index fc7c19d92..2d6bdc3b2 100644 --- a/lib/capistrano/svn.rb +++ b/lib/capistrano/svn.rb @@ -36,7 +36,7 @@ def release end def fetch_revision - context.capture(:svnversion, repo_path).strip + context.capture(:svnversion, repo_path) end end end diff --git a/spec/lib/capistrano/git_spec.rb b/spec/lib/capistrano/git_spec.rb index c350212cd..520b85a8d 100644 --- a/spec/lib/capistrano/git_spec.rb +++ b/spec/lib/capistrano/git_spec.rb @@ -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 diff --git a/spec/lib/capistrano/hg_spec.rb b/spec/lib/capistrano/hg_spec.rb index 5da304041..93c5780c3 100644 --- a/spec/lib/capistrano/hg_spec.rb +++ b/spec/lib/capistrano/hg_spec.rb @@ -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 diff --git a/spec/lib/capistrano/svn_spec.rb b/spec/lib/capistrano/svn_spec.rb index f8656a6a2..77345ea48 100644 --- a/spec/lib/capistrano/svn_spec.rb +++ b/spec/lib/capistrano/svn_spec.rb @@ -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")