Skip to content

Commit

Permalink
fix: fix crashing when one then more parents is found
Browse files Browse the repository at this point in the history
We just display error message because we can't decide what is the first
commit of the branch. And we need very first commit to check if it is
codepush friendly.
  • Loading branch information
xotahal committed Mar 2, 2020
1 parent 2b18bf0 commit e02da33
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion lib/fastlane/plugin/semantic_release/actions/analyze_commits.rb
Original file line number Diff line number Diff line change
Expand Up @@ -143,13 +143,22 @@ def self.is_releasable(params)
end

def self.is_codepush_friendly(params)
git_command = 'git rev-list --max-parents=0 HEAD'
# Begining of the branch is taken for codepush analysis
hash = Actions.sh('git rev-list --max-parents=0 HEAD', log: params[:debug]).chomp
hash_lines = Actions.sh("#{git_command} | wc -l", log: params[:debug]).chomp
hash = Actions.sh(git_command, log: params[:debug]).chomp
next_major = 0
next_minor = 0
next_patch = 0
last_incompatible_codepush_version = '0.0.0'

if hash_lines.to_i > 1
UI.error("#{git_command} resulted to more than 1 hash")
UI.error('This usualy happens when you pull only part of a git history. Check out how you pull the repo! "git fetch" should be enough.')
Actions.sh(git_command, log: true).chomp
return false
end

# Get commits log between last version and head
splitted = get_commits_from_hash(
hash: hash,
Expand Down

0 comments on commit e02da33

Please sign in to comment.