Closed
Description
Current behavior 😯
Calling gix::repository::revision::rev_parse_single
with invalid reference will cause panic in Gix:
For example, with references:
^^^HEAD
^^^
thread 'main' panicked at ~/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/gix-0.70.0/src/revision/spec/parse/error.rs:108:9:
assertion failed: !errors.is_empty()
stack backtrace:
0: rust_begin_unwind
at /rustc/4eb161250e340c8f48f66e2b929ef4a5bed7c181/library/std/src/panicking.rs:692:5
1: core::panicking::panic_fmt
at /rustc/4eb161250e340c8f48f66e2b929ef4a5bed7c181/library/core/src/panicking.rs:75:14
2: core::panicking::panic
at /rustc/4eb161250e340c8f48f66e2b929ef4a5bed7c181/library/core/src/panicking.rs:145:5
3: gix::revision::spec::parse::error::<impl gix::revision::spec::parse::types::Error>::from_errors
at ~/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/gix-0.70.0/src/revision/spec/parse/error.rs:108:9
4: gix::revision::spec::parse::delegate::<impl gix::revision::spec::parse::Delegate>::into_err
at ~/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/gix-0.70.0/src/revision/spec/parse/delegate/mod.rs:44:9
5: gix::revision::spec::parse::<impl gix::revision::Spec>::from_bstr
at ~/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/gix-0.70.0/src/revision/spec/parse/mod.rs:37:48
6: gix::repository::revision::<impl gix::types::Repository>::rev_parse
at ~/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/gix-0.70.0/src/repository/revision.rs:16:9
7: gix::repository::revision::<impl gix::types::Repository>::rev_parse_single
at ~/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/gix-0.70.0/src/repository/revision.rs:34:9
8: tackler_core::parser::tackler_txns::git_to_txns
at ./tackler-core/src/parser/tackler_txns.rs:83:22
9: tackler::run
at ./tackler-cli/src/main.rs:59:13
10: tackler::main
at ./tackler-cli/src/main.rs:147:35
11: core::ops::function::FnOnce::call_once
at ~/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/ops/function.rs:250:5
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
Expected behavior 🤔
With bad references, gix::repository::revision::rev_parse_single
& co. should return error as they normally do.
Git behavior
$ git --version
git version 2.48.1
$ git show '^^^HEAD'
fatal: bad revision '^^^HEAD'
$ git show ^^^
fatal: bad revision '^^^'
Steps to reproduce 🕹
- Call
gix::repository::revision::rev_parse_single
with bad reference
Original triggering test case:
Original test data repository - but this doesn't seem to be related to the repository data, as it's reference parsing issue.
Tacker Test Suite: Git error path tests
Tackler GIX repository code - @Byron has very kindly looked this code already in the past, so the calling code should be ok, and it works just fine in normal cases (with syntactically valid references).