Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions gitoxide-core/src/repository/revision/explain.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Comment thread
Byron marked this conversation as resolved.
_ => unreachable!("BUG: parser assures of that"),
}
)
Expand Down
3 changes: 2 additions & 1 deletion gix-revision/src/spec/parse/delegate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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>;
Expand Down
5 changes: 5 additions & 0 deletions gix-revision/src/spec/parse/function.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
Loading