From b37a28514126ac46e06cc1f5c8cc124a0fdff7f1 Mon Sep 17 00:00:00 2001 From: Xu Cheng Date: Sun, 27 Sep 2015 22:15:58 +0800 Subject: [PATCH] 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 --- Library/Homebrew/cmd/test-bot.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/Library/Homebrew/cmd/test-bot.rb b/Library/Homebrew/cmd/test-bot.rb index 58b30c4054..66f23d873d 100644 --- a/Library/Homebrew/cmd/test-bot.rb +++ b/Library/Homebrew/cmd/test-bot.rb @@ -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