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

Unable to build projects after updating to 1.46.0 when our repo is using sparse-checkouts #8746

Closed
photex opened this issue Oct 1, 2020 · 3 comments · Fixed by #8778
Closed
Assignees
Labels
A-git Area: anything dealing with git C-bug Category: bug

Comments

@photex
Copy link

photex commented Oct 1, 2020

Problem
Since updating to 1.46.0, for some reason we can't build our application if a git clone is using sparse checkouts.

Steps

c:\projects>cargo init foo

c:\projects>cd foo\                                                                                                                                                                                                                                                                                                                         

c:\projects\foo>git init                                                                                                                                              Initialized empty Git repository in C:/projects/foo/.git/                                                                                                                                                                                                                                                                                   

c:\projects\foo>mkdir bar                                                                                                                                                                                                                                                                                                                   

c:\projects\foo>touch bar/test.txt                                                                                                                                                                                                                                                                                                          

c:\projects\foo>echo fn main() { () } > build.rs                                                                                                                                                                                                                                                                                          

c:\projects\foo>vim build.rs

c:\projects\foo>ls
bar  build.rs  Cargo.toml  src                                                                                                                                                                                                                                                                                                              

c:\projects\foo>cargo run
   Compiling foo v0.1.0 (C:\projects\foo)
    Finished dev [unoptimized + debuginfo] target(s) in 1.31s
     Running `target\x86_64-pc-windows-msvc\debug\foo.exe`
Hello, world!


c:\projects\foo>git sparse-checkout init --cone

c:\projects\foo>git sparse-checkout add src

c:\projects\foo>cargo run
error: failed to determine package fingerprint for build script for foo v0.1.0 (C:\projects\foo)

Caused by:
  failed to determine the most recently modified file in c:\projects\foo

Caused by:
  failed to determine list of files in c:\projects\foo

Caused by:
  did not expect repo at c:/projects/foo/.git/ to be bare

c:\projects\foo>

Possible Solution(s)
I have no idea. Sorry!

Notes

Output of cargo version: cargo 1.46.0 (149022b 2020-07-17)

As far as I can tell this really breaks things in a solid way. Just disabling sparse-checkout after this isn't enough to recover.

@photex photex added the C-bug Category: bug label Oct 1, 2020
@photex
Copy link
Author

photex commented Oct 1, 2020

Ah, if you edit .git\config and remove:

[extensions]
worktreeConfig = true 

Then you'll be able to build again.

@ehuss
Copy link
Contributor

ehuss commented Oct 7, 2020

Posted libgit2/libgit2#5656 to start the ball rolling to fix this.

@ehuss ehuss added the A-git Area: anything dealing with git label Oct 7, 2020
@ehuss ehuss self-assigned this Oct 7, 2020
@jynnantonix
Copy link

Could we also change cargo so that it doesn't fail if it cannot understand the git repo? It doesn't matter if the repo is completely borked; as long as there is a valid Cargo.toml, cargo should be able to run the build.

@ehuss ehuss mentioned this issue Oct 14, 2020
@bors bors closed this as completed in 60194f2 Oct 14, 2020
ehuss pushed a commit to ehuss/cargo that referenced this issue Oct 14, 2020
Update git2.

Closes rust-lang#8517
Closes rust-lang#8588
Closes rust-lang#8352
Closes rust-lang#4777
Closes rust-lang#8746

I only added a test for one of these. I can add for the others if you want.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-git Area: anything dealing with git C-bug Category: bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants