gitext-rs / git-stack

Stacked branch management for Git
Apache License 2.0
491 stars 19 forks source link

git sync panic with Unexpected git2 error #318

Open sublimeye opened 10 months ago

sublimeye commented 10 months ago

Please complete the following tasks

Description

Version

git-stack 0.10.17

Steps to reproduce

prerequisites

steps

install git stack register aliases checkout a repo / master branch (no changes) run git sync

Actual Behaviour

panic

Expected Behaviour

no panic

Debug Output

[TRACE git_stack::config] Loading gitconfig [TRACE git_stack::config] Loading /home/_/.gitconfig [TRACE gitstack::config] Loading /home//config [DEBUG globset] built glob set; 0 literals, 5 basenames, 0 extensions, 0 prefixes, 0 suffixes, 0 required extensions, 0 regexes [TRACE git_stack::git::repo] Loading local branches [TRACE git_stack::git::protect] master is ignored by "master" [TRACE git_stack::graph::branch] Branch master is protected [DEBUG git_stack::ops] Chose branch origin/master as the base for origin/master [TRACE git_stack::graph::branch] Branch poppy-bare-root is not on the branch of 78ccc83ed415e5f30fd572b6c48ed294eaa662b8 [TRACE os_info::imp] linux::current_platform is called [TRACE os_info::imp::lsb_release] lsb_release command returned Output { status: ExitStatus(unix_wait_status(0)), stdout: "Distributor ID:\tUbuntu\nDescription:\tUbuntu 20.04.6 LTS\nRelease:\t20.04\nCodename:\tfocal\n", stderr: "No LSB modules are available.\n" } [TRACE os_info::imp::lsb_release] Trying to parse "Distributor ID:\tUbuntu\nDescription:\tUbuntu 20.04.6 LTS\nRelease:\t20.04\nCodename:\tfocal\n" [TRACE os_info::imp::lsb_release] Parsed as 'Some("Ubuntu")' distribution and 'Some("20.04")' version [TRACE os_info::imp] Returning Info { os_type: Ubuntu, version: Custom("20.04"), edition: None, codename: Some("focal"), bitness: X64, architecture: Some("x86_64") } Well, this is embarrassing.

tracefile

name = "git-stack" operating_system = "Ubuntu 20.04 (focal) [64-bit]" crate_version = "0.10.17" explanation = """ Panic occurred in file '/home/username/.cargo/registry/src/index.crates.io-6f17d22bba15001f/git-stack-0.10.17/src/git/repo.rs' at line 184 """ cause = "Unexpected git2 error: invalid data in index - calculated checksum does not match expected; class=Index (10)" method = "Panic" backtrace = """

0: 0x564f516649e0 - git_stack::git::repo::GitRepo::is_dirty::h03c07a5f74680362 1: 0x564f516685bc - git_stack::git::repo::stash_push::hf8580558d076d206 2: 0x564f5158b75c - git_stack::sync::SyncArgs::exec::hd8902831d68a03fc 3: 0x564f515990a9 - git_stack::args::Args::exec::h5185612fc3b1b138 4: 0x564f5156ade3 - git_stack::run::ha096894fe63ff735 5: 0x564f5156a688 - git_stack::main::h262e0a49089c1e64 6: 0x564f515a9583 - std::sys_common::backtrace::__rust_begin_short_backtrace::h9c19c74b83540e41 7: 0x564f515a51a9 - std::rt::lang_start::{{closure}}::hb24346ccad80bb0d 8: 0x564f518bb5fb - core::ops::function::impls::<impl core::ops::function::FnOnce for &F>::call_once::h75ba4244a1c7bb54 at /rustc/5680fa18feaa87f3ff04063800aec256c3d4b4be/library/core/src/ops/function.rs:284

  • std::panicking::try::do_call::h0a2baa36dea975a1 at /rustc/5680fa18feaa87f3ff04063800aec256c3d4b4be/library/std/src/panicking.rs:500
  • std::panicking::try::h0e42aa233d4224d4 at /rustc/5680fa18feaa87f3ff04063800aec256c3d4b4be/library/std/src/panicking.rs:464
  • std::panic::catch_unwind::hefdfd8f482606434 at /rustc/5680fa18feaa87f3ff04063800aec256c3d4b4be/library/std/src/panic.rs:142
  • std::rt::lang_start_internal::{{closure}}::h457959f0f91da23b at /rustc/5680fa18feaa87f3ff04063800aec256c3d4b4be/library/std/src/rt.rs:148
  • std::panicking::try::do_call::h112cfd1acb38183b at /rustc/5680fa18feaa87f3ff04063800aec256c3d4b4be/library/std/src/panicking.rs:500
  • std::panicking::try::ha64f15b20cec18ca at /rustc/5680fa18feaa87f3ff04063800aec256c3d4b4be/library/std/src/panicking.rs:464
  • std::panic::catch_unwind::hbacc2b68ee2c119e at /rustc/5680fa18feaa87f3ff04063800aec256c3d4b4be/library/std/src/panic.rs:142
  • std::rt::lang_start_internal::h5f408694586c2a05 at /rustc/5680fa18feaa87f3ff04063800aec256c3d4b4be/library/std/src/rt.rs:148 9: 0x564f5156afd5 - main 10: 0x7f19abf4e083 - __libc_start_main 11: 0x564f5151d93e - _start 12: 0x0 - """
epage commented 10 months ago

cause = "Unexpected git2 error: invalid data in index - calculated checksum does not match expected; class=Index (10)"

That is an interesting error. I'm curious if you have any idea how your repo got into that state so I can reproduce this

epage commented 10 months ago

(it'd also be helpful for knowing how we should respond to that error)

arxanas commented 10 months ago

You might want to see if https://github.com/arxanas/git-branchless/issues/894 is related.

epage commented 10 months ago

The key information if this is only reproducible with git 2.40+

It looks like it's this issue in libgit2: libgit2/libgit2#6531

You can follow the workaround here:

workaround is to disable the offending option git config --local index.skipHash false. then you have to clear your index and restage all your changes so that the index gets built with the option disabled.

I expect we'll have to wait for libgit2 to fix it and for the changes to propagate downstream.