test-bot: fix start_revision for Travis
When a PR is merged during the test, the commit tree will be looked like
this:
master  PR
  \     /
    \ /
     |
    root
The start_revision will be poined to the commit used to merging PR,
instead of common root commit. As result, `git diff-tree start end`
will list file changes both in PR and master branch, which later
contributes to additional formulae are tested in some Travis builds.
To fix the problem, we use `git merge-base` to get common ancestor as
the real start_revision.
Closes Homebrew/homebrew#44379.
Signed-off-by: Xu Cheng <xucheng@me.com>
			
			
This commit is contained in:
		
							parent
							
								
									79f71ca2ef
								
							
						
					
					
						commit
						b37a285141
					
				@ -318,6 +318,7 @@ module Homebrew
 | 
			
		||||
      # Use Travis CI Git variables for master or branch jobs.
 | 
			
		||||
      elsif ENV["TRAVIS_COMMIT_RANGE"]
 | 
			
		||||
        diff_start_sha1, diff_end_sha1 = ENV["TRAVIS_COMMIT_RANGE"].split "..."
 | 
			
		||||
        diff_start_sha1 = git("merge-base", diff_start_sha1, diff_end_sha1).strip
 | 
			
		||||
      # Otherwise just use the current SHA-1 (which may be overriden later)
 | 
			
		||||
      else
 | 
			
		||||
        diff_end_sha1 = diff_start_sha1 = current_sha1
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user