diff --git a/gitoxide-core/src/repository/revision/explain.rs b/gitoxide-core/src/repository/revision/explain.rs index 75ac2c62823..f2c042e6c86 100644 --- a/gitoxide-core/src/repository/revision/explain.rs +++ b/gitoxide-core/src/repository/revision/explain.rs @@ -197,9 +197,10 @@ impl delegate::Navigate for Explain<'_> { path, stage, match stage { - 0 => "base", - 1 => "ours", - 2 => "theirs", + 0 => "unconflicted", + 1 => "base", + 2 => "ours", + 3 => "theirs", _ => unreachable!("BUG: parser assures of that"), } ) diff --git a/gix-revision/src/spec/parse/delegate.rs b/gix-revision/src/spec/parse/delegate.rs index f768fbcd196..24971bfc59f 100644 --- a/gix-revision/src/spec/parse/delegate.rs +++ b/gix-revision/src/spec/parse/delegate.rs @@ -72,7 +72,8 @@ pub trait Navigate { /// or return `None` if it doesn't exist at this `stage`. /// Note that this implies no revision is needed and no anchor is set yet. /// - /// * `stage` ranges from 0 to 2, with 0 being the base, 1 being ours, 2 being theirs. + /// * `stage` ranges from 0 to 3, with 0 being unconflicted, 1 being the base, 2 being ours + /// and 3 being theirs, just like the stages Git records in the index. /// * `path` without prefix is relative to the root of the repository, while prefixes like `./` and `../` make it /// relative to the current working directory. fn index_lookup(&mut self, path: &BStr, stage: u8) -> Result<(), Exn>; diff --git a/gix-revision/src/spec/parse/function.rs b/gix-revision/src/spec/parse/function.rs index 8eed1a8453d..54ea931264f 100644 --- a/gix-revision/src/spec/parse/function.rs +++ b/gix-revision/src/spec/parse/function.rs @@ -403,6 +403,11 @@ where format!("Couldn't find index '{path}' stage 2", path = path.as_bstr()) }); } + [b':', b'3', b':', path @ ..] => { + return consume_all(delegate.index_lookup(path.as_bstr(), 3), || { + format!("Couldn't find index '{path}' stage 3", path = path.as_bstr()) + }); + } [b':', path @ ..] => { return consume_all(delegate.index_lookup(path.as_bstr(), 0), || { format!("Couldn't find index '{path}' stage 0 (implicit)", path = path.as_bstr()) diff --git a/gix-revision/tests/revision/spec/parse/anchor/colon_symbol.rs b/gix-revision/tests/revision/spec/parse/anchor/colon_symbol.rs index e04a0eefefe..6ed3ff26d6c 100644 --- a/gix-revision/tests/revision/spec/parse/anchor/colon_symbol.rs +++ b/gix-revision/tests/revision/spec/parse/anchor/colon_symbol.rs @@ -87,6 +87,7 @@ fn various_valid_index_lookups_by_path_and_stage() { (":0:path", "path", 0), (":1:dir/path", "dir/path", 1), (":2:dir/path@{part-of-path}", "dir/path@{part-of-path}", 2), + (":3:dir/path", "dir/path", 3), ] { let rec = parse(spec);