Skip to content

Global gitignore not read by default #795

@romainreignier

Description

@romainreignier

Discussed in #793

Originally posted by romainreignier June 15, 2023
In my ~/.gitconfig, I have the following section:

[core]
        excludesfile = /home/user/.gitignore

But go-git does not seem to read it with worktree.Status() and status.IsClean().

I have found the function gitignore.LoadGlobalPatterns() which is supposed to help. But it seems that this function is never called and I don't understand how to use it.

Does someone know how to use it?

Thanks in advance

When using a global gitignore file defined in ~/.gitconfig, go-git does not read it it with worktree.Status() and status.IsClean().

In order for this gitignore to be read, the gitignore.LoadGlobalPatterns() needs to be used, as done in this code I have found with a Github search:

https://github.com/apache/skywalking-eyes/blob/5dfa68f93380a5e57259faaf95088b7f133b5778/pkg/header/check.go#L84-L94

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingno-autocloseIssues/PRs to be ignored by stale bot

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions