diff --git a/lib/pact_broker/client/git.rb b/lib/pact_broker/client/git.rb index e4b53b04..5c13def6 100644 --- a/lib/pact_broker/client/git.rb +++ b/lib/pact_broker/client/git.rb @@ -18,7 +18,7 @@ module PactBroker module Client module Git - COMMAND = 'git branch --remote --verbose --no-abbrev --contains'.freeze + COMMAND = 'git name-rev --name-only HEAD'.freeze BRANCH_ENV_VAR_NAMES = %w{BUILDKITE_BRANCH CIRCLE_BRANCH TRAVIS_BRANCH GIT_BRANCH GIT_LOCAL_BRANCH APPVEYOR_REPO_BRANCH CI_COMMIT_REF_NAME}.freeze def self.branch diff --git a/spec/lib/pact_broker/client/git_spec.rb b/spec/lib/pact_broker/client/git_spec.rb index 42e816e8..a454a868 100644 --- a/spec/lib/pact_broker/client/git_spec.rb +++ b/spec/lib/pact_broker/client/git_spec.rb @@ -26,7 +26,7 @@ module Git context "when there is no known environment variable for the branch", skip_ci: true do it "attempts to execute a git command to determine the value" do - expect { subject }.to_not raise_error + expect(subject).to_not be_empty end end