From bafc850744f6a67019035dfdf335928c09e79515 Mon Sep 17 00:00:00 2001 From: Beth Skurrie Date: Fri, 17 Jan 2020 10:26:12 +1100 Subject: [PATCH] chore: revert to original way of determining git branch --- lib/pact_broker/client/git.rb | 2 +- spec/lib/pact_broker/client/git_spec.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) 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