Skip to content

Commit

Permalink
test for nth prior checkout (#427)
Browse files Browse the repository at this point in the history
  • Loading branch information
Byron committed Aug 2, 2022
1 parent 4f83470 commit 4fd2314
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 3 deletions.
2 changes: 1 addition & 1 deletion git-repository/src/revision/spec/parse/delegate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,7 @@ impl<'repo> delegate::Revision for Delegate<'repo> {

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

Expand Down
Git LFS file not shown
7 changes: 7 additions & 0 deletions git-repository/tests/fixtures/make_rev_spec_parse_repos.sh
Original file line number Diff line number Diff line change
Expand Up @@ -370,4 +370,11 @@ git init complex_graph
baseline "j"
baseline "b^3^2"
baseline "a^^3^2"

baseline "@{-1}"
baseline "@{-2}"
baseline "@{-3}"
baseline "@{-4}"
baseline "@{-5}"
baseline "@{-6}"
)
2 changes: 2 additions & 0 deletions git-repository/tests/revision/spec/from_bytes/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@ pub use util::*;
mod ambiguous;
mod regex;

mod reflog;
mod traverse;

mod index {
use crate::revision::spec::from_bytes::{parse_spec, repo};
use git_repository::prelude::ObjectIdExt;
Expand Down
16 changes: 16 additions & 0 deletions git-repository/tests/revision/spec/from_bytes/reflog.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
use crate::revision::spec::from_bytes::{parse_spec, repo};

#[test]
#[ignore]
fn nth_prior_checkout() {
let repo = repo("complex_graph").unwrap();

for spec in ["@{-1}", "@{-2}", "@{-3}", "@{-4}", "@{-5}"] {
assert!(parse_spec(spec, &repo).is_ok(), "spec {} should be valid", spec);
}

assert_eq!(
parse_spec("@{-6}", &repo).unwrap_err().to_string(),
"HEAD has 5 prior checkouts and checkout 6 is out of range"
);
}

0 comments on commit 4fd2314

Please sign in to comment.