Skip to content

gix integration breaks doc building #13923

Closed
@nerditation

Description

@nerditation

to be honest, until I encountered this problem, I didn't know about gix, but it seems to cause problem when I build docs. below is the commands to reproduce this error:

echo $env.PROCESSOR_ARCHITECTURE
AMD64ver

Microsoft Windows [Version 10.0.19045.4412]cargo --version
cargo 1.80.0-nightly (4de0094ac 2024-05-09)cargo new --lib dummy
    Creating library `dummy` package
note: see more `Cargo.toml` keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.htmlcd dummy\git add .cargo doc
error: failed to determine package fingerprint for documenting dummy v0.1.0 (Y:\dummy)

Caused by:
  failed to determine the most recently modified file in Y:\dummy

Caused by:
  failed to determine list of files in Y:\dummy

Caused by:
  The value for `core.excludesFile` could not be read from configuration

Caused by:
  path is missing

by grepping through the code base for the error messages and some experiments, I managed to pinpoint the failed code is at this line, where the repo.walkdir_iter() method returns Err:

.dirwalk_iter(index.clone(), pathspec, Default::default(), options)?

I did some investigation of the gix code, and it turns out my git config file contains a blank value for core.excludesfile which gix treats differently than a missing core.excludesfile entry.

I opened an issue for gix GitoxideLabs/gitoxide#1370, but I want to at least mention it here, in case someone else enountered similar problem and want to search for reasons.

also, I'm not sure if this is considered a bug for gix or not, but at least it behaves differently from libgit2. when I browse the source code of cargo here:

if self
.gctx
.get_env("__CARGO_GITOXIDE_DISABLE_LIST_FILES")
.ok()
.as_deref()
== Some("1")
{
self.discover_git_repo(root)?.map(Git2OrGixRepository::Git2)
} else {
self.discover_gix_repo(root)?.map(Git2OrGixRepository::Gix)
}

I discovered this __CARGO_GITOXIDE_DISABLE_LIST_FILES environment variable )(undocumented anywhere) so I tried to set it, and then cargo doc runs without showing any errors.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-gitArea: anything dealing with gitCommand-docS-acceptedStatus: Issue or feature is accepted, and has a team member available to help mentor or reviewS-blocked-externalStatus: ❌ blocked on something out of the direct control of the Cargo project, e.g., upstream fixregression-from-stable-to-betaRegression in beta that previously worked in stable.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions