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

core.excludesFile config entry exists but has blank value causes error: is this considered a bug or expected behavior? #1370

Closed
nerditation opened this issue May 17, 2024 · 1 comment · Fixed by #1371
Assignees
Labels
acknowledged an issue is accepted as shortcoming to be fixed

Comments

@nerditation
Copy link

I encountered this error when building docs using cargo doc for my project. I did some digging. and managed to locate where the error originated: in config::Cache::excludes_file() it calls self.trusted_file_path() to get the path for the EXCLUDES_FILE:

https://github.com/Byron/gitoxide/blob/d3588ca4fe0364c88e42cdac24ceae548355d99d/gix/src/config/cache/access.rs#L208-L212

in trusted_file_path(), self.resvoled.path_fillter(...) returns a value of Some("") (it's actual type is Path not &str but you get the point) which cause path.interpolate(ctx) to return an Err(interpolate::Error):

https://github.com/Byron/gitoxide/blob/d3588ca4fe0364c88e42cdac24ceae548355d99d/gix/src/config/cache/access.rs#L222-L232


it turns out in my git config file, there exists an entry for core.excludesfile, but it's value is blank:

[core]
	excludesfile =

I don't remember how it came to be, I think this might be a leftover by the SourceTree GUI app.

and I'm not sure if this is expected behavior or misbehavior, but apparently libgit2 didn't treat this as an error case.

I guess another way to state question is, should path_filter() return Some("") or should it return None for an blank path?

@Byron Byron added the acknowledged an issue is accepted as shortcoming to be fixed label May 17, 2024
@Byron
Copy link
Member

Byron commented May 17, 2024

Thanks for letting me know and for researching the cause of the issue!

I agree that this shouldn't halt the world, even though I also don't know what would be 'right' here. In any case, it will be fixed with priority.

@Byron Byron self-assigned this May 17, 2024
Byron added a commit that referenced this issue May 17, 2024
…iguration enabled. (#1370)

When using `gix::open_opts(path, options.strict_config(false))`, empty `core.excludesFile` values
will not cause an error anymore.

Note that in strict mode, the behaviour is unchanged so invalid configuration can rather be fixed
than ignored.
Byron added a commit that referenced this issue May 17, 2024
…iguration enabled. (#1370)

When using `gix::open_opts(path, options.strict_config(false))`, empty `core.excludesFile` values
will not cause an error anymore.

Note that in strict mode, the behaviour is unchanged so invalid configuration can rather be fixed
than ignored.
Byron added a commit that referenced this issue May 17, 2024
…iguration enabled. (#1370)

When using `gix::open_opts(path, options.strict_config(false))`, empty `core.excludesFile` values
will not cause an error anymore.

Note that in strict mode, the behaviour is unchanged so invalid configuration can rather be fixed
than ignored.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
acknowledged an issue is accepted as shortcoming to be fixed
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants