summaryrefslogtreecommitdiff
path: root/qa/qa/git/repository.rb
diff options
context:
space:
mode:
Diffstat (limited to 'qa/qa/git/repository.rb')
-rw-r--r--qa/qa/git/repository.rb19
1 files changed, 8 insertions, 11 deletions
diff --git a/qa/qa/git/repository.rb b/qa/qa/git/repository.rb
index 1367671e3ca..fc753554fc4 100644
--- a/qa/qa/git/repository.rb
+++ b/qa/qa/git/repository.rb
@@ -7,8 +7,6 @@ module QA
class Repository
include Scenario::Actable
- attr_reader :push_error
-
def self.perform(*args)
Dir.mktmpdir do |dir|
Dir.chdir(dir) { super }
@@ -35,7 +33,7 @@ module QA
end
def clone(opts = '')
- `git clone #{opts} #{@uri.to_s} ./ #{suppress_output}`
+ run_and_redact_credentials("git clone #{opts} #{@uri} ./")
end
def checkout(branch_name)
@@ -71,8 +69,9 @@ module QA
end
def push_changes(branch = 'master')
- # capture3 returns stdout, stderr and status.
- _, @push_error, _ = Open3.capture3("git push #{@uri} #{branch} #{suppress_output}")
+ output, _ = run_and_redact_credentials("git push #{@uri} #{branch}")
+
+ output
end
def commits
@@ -81,12 +80,10 @@ module QA
private
- def suppress_output
- # If we're running as the default user, it's probably a temporary
- # instance and output can be useful for debugging
- return if @username == Runtime::User.default_name
-
- "&> #{File::NULL}"
+ # Since the remote URL contains the credentials, and git occasionally
+ # outputs the URL. Note that stderr is redirected to stdout.
+ def run_and_redact_credentials(command)
+ Open3.capture2("#{command} 2>&1 | sed -E 's#://[^@]+@#://****@#g'")
end
end
end