Skip to content

Commit

Permalink
[FAB-7183] check_license misses some newly added files
Browse files Browse the repository at this point in the history
This patch fixes the check_license script to detect new files
in previous commits and also include cached files in local
changes.

The script wasn't properly detecting new files due to a
reversal in the commit hashes in git diff-tree.

Change-Id: I79417c28f47869a0c336dbbcd226e5a78d3c5daa
Signed-off-by: Troy Ronda <troy@troyronda.com>
  • Loading branch information
troyronda committed Nov 29, 2017
1 parent f5ab5d7 commit 94de933
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions test/scripts/check_license.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,12 @@ function filterExcludedFiles {
| grep -v .md$ | grep -v ^vendor/ | grep -v ^build/ | grep -v .pb.go$ | sort -u`
}

CHECK=$(git diff --name-only HEAD --diff-filter=ACMRTUXB *)
CHECK=$(git diff --name-only HEAD --diff-filter=ACMRTUXB --cached)
filterExcludedFiles

if [[ -z "$CHECK" ]]; then
CHECK=$(git diff-tree --no-commit-id --name-only --diff-filter=ACMRTUXB -r $(git log -2 \
--pretty=format:"%h"))
filterExcludedFiles
LAST_COMMITS=($(git log -2 --pretty=format:"%h"))
CHECK=$(git diff-tree --no-commit-id --name-only --diff-filter=ACMRTUXB -r ${LAST_COMMITS[1]} ${LAST_COMMITS[0]})
filterExcludedFiles
fi

if [[ -z "$CHECK" ]]; then
Expand Down

0 comments on commit 94de933

Please sign in to comment.