fastlane/lib/fastlane/helper/git_helper.rb in fastlane-2.184.1 vs fastlane/lib/fastlane/helper/git_helper.rb in fastlane-2.185.0

- old
+ new

@@ -122,16 +122,21 @@ # Returns the current git branch, or "HEAD" if it's not checked out to any branch # Can be replaced using the environment variable `GIT_BRANCH` def self.git_branch env_name = SharedValues::GIT_BRANCH_ENV_VARS.find { |env_var| FastlaneCore::Env.truthy?(env_var) } ENV.fetch(env_name.to_s) do - # Rescues if not a git repo or no commits in a git repo - begin - Actions.sh("git rev-parse --abbrev-ref HEAD", log: false).chomp - rescue => err - UI.verbose("Error getting git branch: #{err.message}") - nil - end + self.git_branch_name_using_HEAD + end + end + + # Returns the checked out git branch name or "HEAD" if you're in detached HEAD state + def self.git_branch_name_using_HEAD + # Rescues if not a git repo or no commits in a git repo + begin + Actions.sh("git rev-parse --abbrev-ref HEAD", log: false).chomp + rescue => err + UI.verbose("Error getting git branch: #{err.message}") + nil end end private_class_method def self.git_log_merge_commit_filtering_option(merge_commit_filtering)