Skip to content

Commit f49779d

Browse files
committed
Ignore renamed files for mustache lint
If files are only renamed, and do not contain any other changes, there is not need to mustache lint them.
1 parent bb73822 commit f49779d

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

list_changed_files/list_changed_files.sh

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@
1010
# Don't be strict. Script has own error control handle
1111
set +e
1212

13+
difffilter=${1:-"ACDMRTUXB"}
14+
1315
# Verify everything is set
1416
required="gitcmd gitdir initialcommit finalcommit"
1517
for var in $required; do
@@ -46,5 +48,5 @@ if [[ ${PIPESTATUS[0]} -ne 0 ]]; then
4648
fi
4749

4850
# get all the files changed between both commits (no matter the diffs are empty)
49-
git log --name-only --pretty=oneline --full-index ${initialcommit}..${finalcommit} | \
51+
git log --diff-filter=${difffilter} --find-renames=100% --name-only --pretty=oneline --full-index ${initialcommit}..${finalcommit} | \
5052
grep -vE '^[0-9a-f]{40} ' | sort | uniq

mustache_lint/mustache_lint.sh

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,9 @@ echo "Validating using $validator"
4646

4747
export initialcommit=${GIT_PREVIOUS_COMMIT}
4848
export finalcommit=${GIT_COMMIT}
49-
if mfiles=$(${mydir}/../list_changed_files/list_changed_files.sh)
49+
# Fetch all files, excluding files which are renames.
50+
# There is no need to check renames.
51+
if mfiles=$(${mydir}/../list_changed_files/list_changed_files.sh r)
5052
then
5153
echo "Running mustache lint from $initialcommit to $finalcommit:"
5254
else

0 commit comments

Comments
 (0)