-
-
Notifications
You must be signed in to change notification settings - Fork 2k
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
First entry of gitignore searched if it starts with BOM #2177
Comments
I believe the description of your bug report is correct, but your reproduction isn't.
But I suspect the fix will be to tweak this code to handle the BOM: ripgrep/crates/ignore/src/gitignore.rs Lines 386 to 408 in ced5b92
|
Oh, yes, sorry for the incomplete reproduction. I was actually running the commands in an initialized git repo. I'll try to fix this in the next days with the help of your pointer above if nobody else is faster. |
Here is what Git does: https://github.com/git/git/blob/21306a098c3f174ad4c2a5cddb9069ee27a548b0/utf8.c#L794-L803 const char utf8_bom[] = "\357\273\277";
int skip_utf8_bom(char **text, size_t len)
{
if (len < strlen(utf8_bom) ||
memcmp(*text, utf8_bom, strlen(utf8_bom)))
return 0;
*text += strlen(utf8_bom);
return 1;
} If |
Match Git's behavior. Fixes BurntSushi#2177.
What version of ripgrep are you using?
ripgrep 13.0.0
-SIMD -AVX (compiled)
+SIMD +AVX (runtime)
How did you install ripgrep?
pacman -S ripgrep
What operating system are you using ripgrep on?
Arch Linux
Describe your bug.
When a .gitignore starts with a BOM, ripgrep does not ignore the first entry of the .gitignore. git itself ignores the first entry.
What are the steps to reproduce the behavior?
What is the actual behavior?
What is the expected behavior?
It should ignore
ignoreme
because git does so as well. See e.g.git status
.The text was updated successfully, but these errors were encountered: