Skip to content

Commit ecc219e

Browse files
committed
check [nfc]: Say git diff -a rather than git diff --text
Normally in scripts I prefer using long options, to make the meaning more explicit for the reader. But this particular option `--text` on `git diff` has a pretty confusing name: it sounds like it potentially means "only look at text files", which is the opposite of what it turns out to mean. Plus its meaning really isn't about "text" (vs "binary") at all: the files we set the `-diff` attribute on are mostly just as textual as any others, just boring for diffs because they're generated. So use the short name `-a` instead. That suggests "all", which is exactly the right idea. Also expand the comment a bit.
1 parent 15ec576 commit ecc219e

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

tools/check

+3-2
Original file line numberDiff line numberDiff line change
@@ -189,8 +189,9 @@ files_check() {
189189
check_no_changes() {
190190
local change_description="$1"; shift
191191

192-
# To include files excluded in `.gitattributes`, --text is necessary.
193-
if git diff --text --quiet -- "$@" \
192+
# We use `git diff -a` in order to include all matching files,
193+
# overriding our `.gitattributes` which excludes generated files.
194+
if git diff -a --quiet -- "$@" \
194195
&& no_untracked_files "$@"; then
195196
return
196197
fi

0 commit comments

Comments
 (0)