Skip to content

Respect gitignore file even when not in a git repository#183368

Merged
andreamah merged 1 commit into
microsoft:mainfrom
cmtm:gitignore-no-require-git
Jun 5, 2023
Merged

Respect gitignore file even when not in a git repository#183368
andreamah merged 1 commit into
microsoft:mainfrom
cmtm:gitignore-no-require-git

Conversation

@cmtm

@cmtm cmtm commented May 24, 2023

Copy link
Copy Markdown
Contributor

If a .gitignore file exists in a workspace, we currently only respect it
if we're also in a git repository. This is because of ripgrep's default
behavior. Pass an extra flag to ripgrep so that it always respects the
.gitignore file if it exists.

Fixes #182958

@cmtm

cmtm commented May 24, 2023

Copy link
Copy Markdown
Contributor Author

@microsoft-github-policy-service agree

@andreamah andreamah added this to the June 2023 milestone May 29, 2023
@andreamah

Copy link
Copy Markdown
Contributor

Looks good! Haven't tested it quite yet, but could you fix the failing test here?

Seems that it's not passing CI.

@cmtm cmtm force-pushed the gitignore-no-require-git branch 2 times, most recently from bab5d79 to d4c4377 Compare May 30, 2023 20:42
If a .gitignore file exists in a workspace, we currently only respect it
if we're also in a git repository. This is because of ripgrep's default
behavior. Pass an extra flag to ripgrep so that it always respects the
.gitignore file if it exists.
@cmtm cmtm force-pushed the gitignore-no-require-git branch from d4c4377 to 0b9e3ed Compare May 31, 2023 21:18
@cmtm

cmtm commented Jun 2, 2023

Copy link
Copy Markdown
Contributor Author

@andreamah , the test should now be passing. Anything else needed to get this in?

@andreamah andreamah left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great, thanks!

@andreamah andreamah enabled auto-merge (squash) June 5, 2023 21:19
@andreamah andreamah merged commit d77b835 into microsoft:main Jun 5, 2023
@cmtm cmtm deleted the gitignore-no-require-git branch June 6, 2023 18:53
@github-actions github-actions Bot locked and limited conversation to collaborators Jul 20, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

.gitignore files don't take effect in Search if there is no .git folder

3 participants