Skip to content
This repository has been archived by the owner on May 5, 2021. It is now read-only.

Commit

Permalink
Handle non-master default branch names
Browse files Browse the repository at this point in the history
  • Loading branch information
speshak committed Mar 30, 2021
1 parent 0760fe7 commit 155e4bc
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion check_file_change
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@ if [ ! -e "${ROOT}/${CHECKED_FILE}" ]; then
exit 0
fi

if git diff --name-status master "${ROOT}/${CHECKED_FILE}" | grep -Eq "^M\\s+${CHECKED_FILE}$" ; then
DEFAULT_BRANCH=$(git remote show origin | grep "HEAD branch" | cut -d ":" -f 2 | sed 's/ //')

if git diff --name-status "${DEFAULT_BRANCH}" "${ROOT}/${CHECKED_FILE}" | grep -Eq "^M\\s+${CHECKED_FILE}$" ; then
# The checked file has been modified
exit 0
else
Expand Down

0 comments on commit 155e4bc

Please sign in to comment.