From 29f48c3d47ed51d1c5de955eb7b7ae773a18abbb Mon Sep 17 00:00:00 2001 From: James Wen Date: Sun, 3 Apr 2016 00:28:20 -0400 Subject: Remove authentication credentials for git sources from printed `bundle install` output - Related to: bundler/bundler-features#111 --- lib/bundler/source/git/git_proxy.rb | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'lib') diff --git a/lib/bundler/source/git/git_proxy.rb b/lib/bundler/source/git/git_proxy.rb index 19e0db86..9ea7a22f 100644 --- a/lib/bundler/source/git/git_proxy.rb +++ b/lib/bundler/source/git/git_proxy.rb @@ -86,12 +86,12 @@ module Bundler def checkout if path.exist? return if has_revision_cached? - Bundler.ui.info "Fetching #{uri}" + Bundler.ui.info "Fetching #{URICredentialsFilter.anonymized_uri(uri)}" in_path do git_retry %(fetch --force --quiet --tags #{uri_escaped_with_configured_credentials} "refs/heads/*:refs/heads/*") end else - Bundler.ui.info "Fetching #{uri}" + Bundler.ui.info "Fetching #{URICredentialsFilter.anonymized_uri(uri)}" SharedHelpers.filesystem_access(path.dirname) do |p| FileUtils.mkdir_p(p) end @@ -145,10 +145,14 @@ module Bundler end def git(command, check_errors = true, error_msg = nil) - raise GitNotAllowedError.new(command) unless allow? + command_with_no_credentials = URICredentialsFilter.credentials_filtered_string(command, uri) + raise GitNotAllowedError.new(command_with_no_credentials) unless allow? + out = SharedHelpers.with_clean_git_env { `git #{command}` } - raise GitCommandError.new(command, path, error_msg) if check_errors && !$?.success? - out + + stdout_with_no_credentials = URICredentialsFilter.credentials_filtered_string(out, uri) + raise GitCommandError.new(command_with_no_credentials, path, error_msg) if check_errors && !$?.success? + stdout_with_no_credentials end def has_revision_cached? -- cgit v1.2.3