Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don’t use .gitignore of a different git repository #893

Closed
SimonSapin opened this issue Apr 22, 2018 · 2 comments
Closed

Don’t use .gitignore of a different git repository #893

SimonSapin opened this issue Apr 22, 2018 · 2 comments
Labels
bug A bug.

Comments

@SimonSapin
Copy link

In a clone of https://github.com/rust-lang/rust with git submodules checked out, in the src/llvm submodule, ripgrep 0.8.1 seems to "miss" several results that are found by GNU grep or git-grep:

~/rust/src/llvm% rg __powisf2                   
lib/Target/WebAssembly/WebAssemblyRuntimeLibcallSignatures.cpp
643:/* POWI_F32 */ "__powisf2",
~/rust/src/llvm% grep -R __powisf2            
include/llvm/CodeGen/RuntimeLibcalls.def:HANDLE_LIBCALL(POWI_F32, "__powisf2")
test/CodeGen/Mips/msa/f16-llvm-ir.ll:; MIPS32-DAG:     lw $25, %call16(__powisf2)($gp)
test/CodeGen/Mips/msa/f16-llvm-ir.ll:; MIPS64-N32-DAG: lw $25, %call16(__powisf2)($gp)
test/CodeGen/Mips/msa/f16-llvm-ir.ll:; MIPS64-N64-DAG: ld $25, %call16(__powisf2)($gp)
test/CodeGen/Mips/pr36061.ll:; MIPSN64-NEXT:    jal __powisf2
test/CodeGen/Mips/pr36061.ll:; MIPSN32-NEXT:    jal __powisf2
test/CodeGen/AArch64/illegal-float-ops.ll:; CHECK: bl __powisf2
test/CodeGen/AArch64/f16-instructions.ll:; CHECK-COMMON-NEXT: bl {{_?}}__powisf2
test/CodeGen/AArch64/arm64-illegal-float-ops.ll:; CHECK: bl __powisf2
test/CodeGen/SystemZ/fp-libcall.ll:; CHECK: brasl %r14, __powisf2@PLT
test/CodeGen/Thumb2/intrinsics-cc.ll:; CHECK: b __powisf2
test/CodeGen/Thumb2/float-intrinsics-float.ll:; SOFT: bl __powisf2
test/CodeGen/Thumb2/float-intrinsics-float.ll:; HARD: b __powisf2
test/CodeGen/ARM/Windows/powi.ll:; CHECK-NOT: __powisf2
test/CodeGen/ARM/Windows/powi.ll:; CHECK-NOT: __powisf2
test/CodeGen/ARM/Windows/powi.ll:; CHECK-NOT: bl __powisf2
test/CodeGen/ARM/fp16-promote.ll:; CHECK-FP16: bl __powisf2
test/CodeGen/ARM/fp16-promote.ll:; CHECK-LIBCALL: bl __powisf2
test/CodeGen/XCore/float-intrinsics.ll:; CHECK: bl __powisf2
lib/Target/WebAssembly/WebAssemblyRuntimeLibcallSignatures.cpp:/* POWI_F32 */ "__powisf2",

This turns out to be because of the .gitignore file at the root of the Rust repository. Running with --no-ignore-parent makes it find those extra results.

These files are not ignored by git. If I modify ~/rust/src/llvm/include/llvm/CodeGen/RuntimeLibcalls.def for example, git status will show it as modified. My understanding is that ~/rust/.gitignore is not relevant to RuntimeLibcalls.def because it belongs to a different repository. This is detected by the presence of a .git directory (or file) at ~/rust/src/llvm/.git.

When going up the parent/ancestor directories, ripgrep should probably stop considering .gitignore files after it goes beyond the root of a git repository (as indicated by .git). Conversely, when descending into a directory that contains .git, it should maybe stop considering .gitignore files that are "above" this directory.

@BurntSushi
Copy link
Owner

Ah this is a great bug! ripgrep does actually know to stop respecting parent .gitignore once it crosses a repository boundary. The problem is that it's looking for a .git directory:

has_git: dir.join(".git").is_dir(),

But it looks like .git can also be a file, which ripgrep should obviously respect. I think fixing that should completely fix this.

@BurntSushi BurntSushi added the bug A bug. label Apr 22, 2018
@SimonSapin
Copy link
Author

Indeed, it looks like .git is a file for submodules too. I hadn’t realized that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug A bug.
Projects
None yet
Development

No branches or pull requests

2 participants