Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

.gitignore: update the command to check tracked files being ignored

Recent git versions do not accept the noted command.

$ git ls-files -i --exclude-standard
fatal: ls-files -i must be used with either -o or -c

The -c was implied before, but we need to make it explicit since
git commit b338e9f66873 ("ls-files: error out on -i unless -o or -c
are specified").

Also, replace --exclude-standard with --exclude-per-directory=.gitignore
so that everyone will get consistent results.

git-ls-files(1) says:

--exclude-standard
Add the standard Git exclusions: .git/info/exclude, .gitignore in
each directory, and the user's global exclusion file.

We cannot predict what is locally added to .git/info/exclude or the
user's global exclusion file.

We can only manage .gitignore files committed to the repository.

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
Reviewed-by: Miguel Ojeda <ojeda@kernel.org>

+1 -1
+1 -1
.gitignore
··· 4 4 # subdirectories here. Add them in the ".gitignore" file 5 5 # in that subdirectory instead. 6 6 # 7 - # NOTE! Please use 'git ls-files -i --exclude-standard' 7 + # NOTE! Please use 'git ls-files -i -c --exclude-per-directory=.gitignore' 8 8 # command after changing this file, to see if there are 9 9 # any tracked files which get ignored after the change. 10 10 #