Skip to content

Commit 4fd2314

Browse files
committed
test for nth prior checkout (#427)
1 parent 4f83470 commit 4fd2314

File tree

5 files changed

+28
-3
lines changed

5 files changed

+28
-3
lines changed

git-repository/src/revision/spec/parse/delegate.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -283,7 +283,7 @@ impl<'repo> delegate::Revision for Delegate<'repo> {
283283

284284
fn sibling_branch(&mut self, _kind: SiblingBranch) -> Option<()> {
285285
self.unset_disambiguate_call();
286-
todo!()
286+
todo!("once remote handling and ref-specs are fleshed out much more")
287287
}
288288
}
289289

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
version https://git-lfs.github.com/spec/v1
2-
oid sha256:f5cde687a063623b1277f179c2015a08b07e819ad8278a066172c3fc4e08316e
3-
size 28084
2+
oid sha256:4684b243803678e18130357413321361a4f6cb38076590404bf81788b6f2a1c6
3+
size 28116

git-repository/tests/fixtures/make_rev_spec_parse_repos.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -370,4 +370,11 @@ git init complex_graph
370370
baseline "j"
371371
baseline "b^3^2"
372372
baseline "a^^3^2"
373+
374+
baseline "@{-1}"
375+
baseline "@{-2}"
376+
baseline "@{-3}"
377+
baseline "@{-4}"
378+
baseline "@{-5}"
379+
baseline "@{-6}"
373380
)

git-repository/tests/revision/spec/from_bytes/mod.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,9 @@ pub use util::*;
88
mod ambiguous;
99
mod regex;
1010

11+
mod reflog;
1112
mod traverse;
13+
1214
mod index {
1315
use crate::revision::spec::from_bytes::{parse_spec, repo};
1416
use git_repository::prelude::ObjectIdExt;
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
use crate::revision::spec::from_bytes::{parse_spec, repo};
2+
3+
#[test]
4+
#[ignore]
5+
fn nth_prior_checkout() {
6+
let repo = repo("complex_graph").unwrap();
7+
8+
for spec in ["@{-1}", "@{-2}", "@{-3}", "@{-4}", "@{-5}"] {
9+
assert!(parse_spec(spec, &repo).is_ok(), "spec {} should be valid", spec);
10+
}
11+
12+
assert_eq!(
13+
parse_spec("@{-6}", &repo).unwrap_err().to_string(),
14+
"HEAD has 5 prior checkouts and checkout 6 is out of range"
15+
);
16+
}

0 commit comments

Comments
 (0)