Skip to content

.gitignore from parent folders impacts formatting of children #1627

@yonguelink

Description

@yonguelink

My {Home} folder, on windows, is managed via a git repository so I have the following file structure:

{Home}/.git/...
{Home}/.gitignore
{Home}/repos/{bunch of repositories}

The .gitignore in the {Home} folder contains repos to avoid committing stuff from the repositories I have on different machines into this "Home" repo.

Since I updated to csharpier 1.0.2 (I went from 0.30.x to 1.0.2), all my files are ignored by csharpier:

Image

After digging around, it's the repos in the .gitignore of my {Home} folder that's causing the issue.

Environments:

  • CSharpier Version: 1.0.2
  • Running CSharpier via: dotnet cli
  • Operating System: Windows
  • .csharpierrc Settings: Default
  • .editorconfig Settings: Default

Steps to reproduce:

  • Have a .gitignore somewhere in the directory chain of your files
  • Said .gitignore ignores the folder containing your files
  • Run the format or check commands

Or check the content of the following zip:

csharpier-reproduction.zip

If you uncomment the repos line in the root's .gitignore the formatting of the /repos/demo.cs file works.

Expected behavior:

The files should be formatted/checked.

I suggest that once a .gitignore file is found, to stop going further up in the chain.

Actual behavior:

The files are all ignored

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions