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

With git index verson = 4 and build script cargo can not build any project #13153

Closed
Dushistov opened this issue Dec 11, 2023 · 1 comment
Closed
Labels
A-git Area: anything dealing with git C-bug Category: bug S-triage Status: This issue is waiting on initial triage.

Comments

@Dushistov
Copy link

Problem

Recently I tried https://www.git-tower.com/blog/git-performance/ to improve git performance,
but git update-index --index-version 4 breaks cargo.

Steps

❯ cargo new --bin demo2
     Created binary (application) `demo2` package
❯ cd demo2
❯ git update-index --show-index-version
0
❯ git add -A

❯ git commit -m "initial commit" -a
[master (root-commit) b49adb2] initial commit
 3 files changed, 12 insertions(+)
 create mode 100644 .gitignore
 create mode 100644 Cargo.toml
 create mode 100644 src/main.rs

❯ git config feature.manyFiles true
❯ git update-index --index-version 4
❯ git update-index --show-index-version
4
❯ git branch
* master

❯ PAGER= git log
commit b49adb2b54620710ee48e64bda608daf6029d47a (HEAD -> master)
Date:   Mon Dec 11 13:55:11 2023 +0300

    initial commit
❯ cargo build
   Compiling demo2 v0.1.0 (/tmp/demo2)
    Finished dev [unoptimized + debuginfo] target(s) in 0.13s

❯ echo "fn main() {}" > build.rs
❯ cargo check
error: failed to determine package fingerprint for build script for demo2 v0.1.0 (/tmp/demo2)

Caused by:
  failed to determine the most recently modified file in /tmp/demo2

Caused by:
  failed to determine list of files in /tmp/demo2

Caused by:
  failed to open git index at /tmp/demo2/.git/

Caused by:
  invalid data in index - calculated checksum does not match expected; class=Index (10)

Here is script to reproduce problem:

#!/bin/sh
#
set -euo pipefail

export LC_ALL=C
cd /tmp
cargo new --bin demo3
cd demo3
git update-index --show-index-version
git add -A
git commit -m "initial commit" -a
git config feature.manyFiles true
git update-index --index-version 4
git update-index --show-index-version
git branch
PAGER= git log
cargo build
echo "fn main() {}" > build.rs
cargo check

Possible Solution(s)

No response

Notes

No response

Version

❯ cargo version --verbose
cargo 1.75.0-beta.5 (1d8b05cdd 2023-11-20)
release: 1.75.0-beta.5
commit-hash: 1d8b05cdd1287c64467306cf3ca2c8ac60c11eb0
commit-date: 2023-11-20
host: x86_64-unknown-linux-gnu
libgit2: 1.7.1 (sys:0.18.1 vendored)
libcurl: 8.4.0-DEV (sys:0.4.68+curl-8.4.0 vendored ssl:OpenSSL/1.1.1u)
ssl: OpenSSL 1.1.1u  30 May 2023
os: Arch Linux Rolling Release [64-bit]
@Dushistov Dushistov added C-bug Category: bug S-triage Status: This issue is waiting on initial triage. labels Dec 11, 2023
@epage epage added the A-git Area: anything dealing with git label Dec 11, 2023
@ehuss
Copy link
Contributor

ehuss commented Dec 11, 2023

Thanks for the report, and the detailed repro! This isn't exactly related to the index version, but is the consequence of feature.manyFiles enabling index.skipHash. This is tracked in #11857, so closing as a duplicate of that.

@ehuss ehuss closed this as not planned Won't fix, can't repro, duplicate, stale Dec 11, 2023
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 S-triage Status: This issue is waiting on initial triage.
Projects
None yet
Development

No branches or pull requests

3 participants