问题描述:

I have a Travis script that runs for every push.

I need to determine which files were modified in this push.

Currently, I have this:

CHANGED_FILES=($(git diff --name-only HEAD HEAD~1))

The problem is that sometimes a push can include more than one commits, and this only looks at the last commit.

What is the expected way to solve this?

网友答案:

I found out there is a Travis environment variable: $TRAVIS_COMMIT_RANGE.

Then it was only a matter of changing the script to:

CHANGED_FILES=($(git diff --name-only $TRAVIS_COMMIT_RANGE))

相关阅读:
Top