Message ID | 20221224155138.447912-1-masahiroy@kernel.org (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | [v2,1/2] .gitinogre: update the command to check tracked files being ignored | expand |
On Sat, Dec 24, 2022 at 4:51 PM Masahiro Yamada <masahiroy@kernel.org> wrote: > > The -c was implied for older git versions, but we need to make it > explicit now. Perhaps add a `Link:` to Git's commit b338e9f66873 ("ls-files: error out on -i unless -o or -c are specified") https://git.kernel.org/pub/scm/git/git.git/commit/?id=b338e9f668737e08201c990450b8c3d744f63162 > We never know what are locally added to $GIT_DIR/info/exclude or > $XDG_CONFIG_HOME/git/ignore. Perhaps we could say "global exclusion file" instead (since it could be the one from `core.excludesFile` too). > Signed-off-by: Masahiro Yamada <masahiroy@kernel.org> By the way, in the commit title: "gitinogre" -> "gitignore" Reviewed-by: Miguel Ojeda <ojeda@kernel.org> Cheers, Miguel
diff --git a/.gitignore b/.gitignore index 3ec73ead6757..2e2e3d1eeaee 100644 --- a/.gitignore +++ b/.gitignore @@ -4,7 +4,7 @@ # subdirectories here. Add them in the ".gitignore" file # in that subdirectory instead. # -# NOTE! Please use 'git ls-files -i --exclude-standard' +# NOTE! Please use 'git ls-files -i -c --exclude-per-directory=.gitignore' # command after changing this file, to see if there are # any tracked files which get ignored after the change. #
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 for older git versions, but we need to make it explicit now. 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 never know what are locally added to $GIT_DIR/info/exclude or $XDG_CONFIG_HOME/git/ignore. We can only manage .gitignore files committed in the repository. Signed-off-by: Masahiro Yamada <masahiroy@kernel.org> --- (no changes since v1) .gitignore | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)