gitext-rs / git-stack

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

Crash rebasing stack #158

Closed vlovich closed 2 years ago

vlovich commented 2 years ago

Description

I have two branches. I started developing features X & Y on branch D (with preceding branches A, B, & C in the history although I don't think that matters). I then checked out D & did a git stack --rebase to generate D. I'm trying to rebase X & Y onto D so I checked out Y and ran git stack --rebase --onto D (D here corresponding to D`) which crashes with:

cat /tmp/report-580ecdef-8ce1-4fb0-8ccc-ce5622d25210.toml
name = 'git-stack'
operating_system = 'unix:Arch'
crate_version = '0.3.0'
explanation = '''
Panic occurred in file '/home/vlovich/.cargo/registry/src/github.com-1ecc6299db9ec823/git-stack-0.3.0/src/graph/ops.rs' at line 52
'''
cause = 'called `Option::unwrap()` on a `None` value'
method = 'Panic'
backtrace = '''

   0: 0x5648c0d144fd - core::panicking::panic::h344f23ad26057b48
                at /rustc/c8dfcfe046a7680554bf4eb612bad840e7631c4b/library/core/src/panicking.rs:50
   1: 0x5648c0d5ac38 - git_stack::graph::ops::rebase_branches::hbae5bd5ef03c0748
   2: 0x5648c0d20955 - git_stack::stack::plan_rebase::habf3f427bdc8fa6f
   3: 0x5648c0d35114 - <core::iter::adapters::ResultShunt<I,E> as core::iter::traits::iterator::Iterator>::next::h672535ec97f038b4
   4: 0x5648c0d4914c - <alloc::vec::Vec<T> as alloc::vec::spec_from_iter::SpecFromIter<T,I>>::from_iter::h3e8ec2022c030885
   5: 0x5648c0d363be - core::iter::adapters::process_results::h62fc3d1f346d12d0
   6: 0x5648c0d1e619 - git_stack::stack::stack::hb8ae30477ebae538
   7: 0x5648c0d3827d - git_stack::run::h87baf48fb7a3d4f6
   8: 0x5648c0d37dc0 - git_stack::main::h301fc7f9a8485f15
   9: 0x5648c0d31643 - std::sys_common::backtrace::__rust_begin_short_backtrace::h4434b32f4c7f1537
  10: 0x5648c0d3dd99 - std::rt::lang_start::{{closure}}::he9488fe4bc1d7105
  11: 0x5648c0f7c6aa - core::ops::function::impls::<impl core::ops::function::FnOnce<A> for &F>::call_once::ha9408abe89f69dc4
                at /rustc/c8dfcfe046a7680554bf4eb612bad840e7631c4b/library/core/src/ops/function.rs:259
                 - std::panicking::try::do_call::h5b0cc9e9102acb65
                at /rustc/c8dfcfe046a7680554bf4eb612bad840e7631c4b/library/std/src/panicking.rs:401
                 - std::panicking::try::hddc7f8229138b3ba
                at /rustc/c8dfcfe046a7680554bf4eb612bad840e7631c4b/library/std/src/panicking.rs:365
                 - std::panic::catch_unwind::hfa401ff8bab2986e
                at /rustc/c8dfcfe046a7680554bf4eb612bad840e7631c4b/library/std/src/panic.rs:434
                 - std::rt::lang_start_internal::{{closure}}::h8163422320d11405
                at /rustc/c8dfcfe046a7680554bf4eb612bad840e7631c4b/library/std/src/rt.rs:45
                 - std::panicking::try::do_call::hc742cc7bb4f0fb20
                at /rustc/c8dfcfe046a7680554bf4eb612bad840e7631c4b/library/std/src/panicking.rs:401
                 - std::panicking::try::ha37d8d2dd1acf7d3
                at /rustc/c8dfcfe046a7680554bf4eb612bad840e7631c4b/library/std/src/panicking.rs:365
                 - std::panic::catch_unwind::h8a5381d5ecf437bc
                at /rustc/c8dfcfe046a7680554bf4eb612bad840e7631c4b/library/std/src/panic.rs:434
                 - std::rt::lang_start_internal::h7e2cee8c90d4a4d3
                at /rustc/c8dfcfe046a7680554bf4eb612bad840e7631c4b/library/std/src/rt.rs:45
  12: 0x5648c0d383a2 - main
  13: 0x7fa1caa23b25 - __libc_start_main
  14: 0x5648c0d14d6e - _start
  15:        0x0 - <unresolved>'''

Version

0.3

Steps to reproduce

Not sure how to use git-fixture to generate git state...

Actual Behaviour

Crash

Expected Behaviour

No response

Debug Output

[TRACE git_stack::stack] Initializing
[TRACE git_stack::config] Loading gitconfig
[TRACE git_stack::config] Loading /home/vlovich/myproject/.gitconfig
[TRACE git_stack::config] Loading /home/vlovich/myproject/.git/config
[DEBUG globset] built glob set; 2 literals, 5 basenames, 0 extensions, 0 prefixes, 0 suffixes, 0 required extensions, 0 regexes
[TRACE git_stack::git::repo] Loading branches
[TRACE git_stack::git::protect] staging: ignored "staging"
[TRACE git_stack::git::branches] Branch staging is protected
[DEBUG git_stack::git::repo] Failed to stash: cannot stash changes - there is nothing to stash.; class=Stash (19); code=NotFound (-3)
[TRACE git_stack::git::repo] Loading branches
[TRACE git_stack::stash::stack] Reusing snapshot /home/vlovich/myproject/.git/branch-stash/git-stack/3.bak
[TRACE git_stack::graph::node] Populating data for 431b96789fdccd53c8df455165cb43ed58df4b53..ab7266226ad8aa25433c7177cee12425604e9979
[TRACE git_stack::graph::node] Populating data for 431b96789fdccd53c8df455165cb43ed58df4b53..b33ebd153017d8cfc0c90a8cbe1943eaca5bd3bc
[TRACE git_stack::graph::node] Populating data for 431b96789fdccd53c8df455165cb43ed58df4b53..03856585a626709ac1afed4920464b34ba98b8ea
[TRACE git_stack::graph::node] Populating data for 431b96789fdccd53c8df455165cb43ed58df4b53..e2af3fc2d6aad486cac85b21bd55a2bfeb622183
[TRACE git_stack::graph::node] Populating data for 431b96789fdccd53c8df455165cb43ed58df4b53..64e519c6e43b30b1c017d1d3450f791eac44a37f
[TRACE git_stack::graph::node] Populating data for f757cfb557e5b3943b43e6ccc6de58331f346fbc..431b96789fdccd53c8df455165cb43ed58df4b53
[TRACE git_stack::graph::node] Populating data for f757cfb557e5b3943b43e6ccc6de58331f346fbc..03d79cd19e7929c03c4995a700885a579b27f1d9
[TRACE git_stack::graph::node] Populating data for e82dca201cbd117860bd902c8d6ddbd303c120d8..f757cfb557e5b3943b43e6ccc6de58331f346fbc
[TRACE git_stack::graph::node] Populating data for e82dca201cbd117860bd902c8d6ddbd303c120d8..e847bcfff9b0017a30d3b58e1a4fb34b76a84faf
[TRACE git_stack::graph::node] Populating data for e82dca201cbd117860bd902c8d6ddbd303c120d8..5d00da7bf85df3cdb145684ca7aa909581ff4652
[TRACE git_stack::graph::node] Populating data for 9e905350cff274cd89e00ded43bf32bfaad20674..e82dca201cbd117860bd902c8d6ddbd303c120d8
[TRACE git_stack::graph::node] Populating data for 9e905350cff274cd89e00ded43bf32bfaad20674..2e4c0e35b534fb12383445f892a666c480e9653e
[TRACE git_stack::graph::node] Populating data for 9e905350cff274cd89e00ded43bf32bfaad20674..5cb07f88e4d93cc9d22ef89584411ae48c3693a2
epage commented 2 years ago

The code that crashed has been completely rewritten. I'd recommend upgrading to 0.5.0

vlovich commented 2 years ago

Ah awesome. I didn't expect such a quick response so I've moved on with my git history but I've upgraded and will make sure to try this out again.