On Thu, Oct 20, 2016 at 1:16 PM, Jeff King <peff@xxxxxxxx> wrote: > The low-level attribute and gitignore code will try to look > in $GIT_DIR/info for any repo-level configuration files, > even if we have not actually determined that we are in a > repository (e.g., running "git grep --no-index"). In such a > case they end up looking for ".git/info/attributes", etc. > > This is generally harmless, as such a file is unlikely to > exist outside of a repository, but it's still conceptually > the wrong thing to do. > > Let's detect this situation explicitly and skip reading the > file (i.e., the same behavior we'd get if we were in a > repository and the file did not exist). On the other hand, if we invoke attr machinery too early by mistake, before setup_git_directory* is called, then we skip .git/info/attributes file as well even though I think we should shout "call setup_git_directory first!" so the developer can fix it. I wonder if we should have two flags in startup_info to say "yes setup_git_dir... has been called, you can trust startup_info->have_repository" and "yes, i do not call setup_git_dir on purpose, quit complaining" then we could still catch unintended .git/info/attributes ignore while letting git grep --no-index work correctly. -- Duy