diff --git a/git-secrets b/git-secrets index a2f16ac..7079ae2 100755 --- a/git-secrets +++ b/git-secrets @@ -176,6 +176,8 @@ pre_commit_hook() { while IFS= read -r file; do [ -n "$file" ] && files+=("$file") done <<< "$(git diff-index --diff-filter 'ACMU' --name-only --cached $rev --)" + # when the file list empty, then don't all the scan, otherwise it will start scanning entire repo + [[ -z "${files[@]}" ]] && return scan_with_fn_or_die "scan" "${files[@]}" }