Skip to content

Commit

Permalink
officially make sibling branches 'planned' (#427)
Browse files Browse the repository at this point in the history
  • Loading branch information
Byron committed Aug 3, 2022
1 parent ff37fae commit 145631b
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 1 deletion.
5 changes: 4 additions & 1 deletion git-repository/src/revision/spec/parse/delegate.rs
Expand Up @@ -333,7 +333,10 @@ impl<'repo> delegate::Revision for Delegate<'repo> {

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

Expand Down
2 changes: 2 additions & 0 deletions git-repository/src/revision/spec/parse/types.rs
Expand Up @@ -61,6 +61,8 @@ pub struct Options {
#[derive(Debug, thiserror::Error)]
#[allow(missing_docs)]
pub enum Error {
#[error("This feature will be implemented once {dependency}")]
Planned { dependency: &'static str },
#[error("Reference {reference:?} does not have a reference log, cannot {action}")]
MissingRefLog { reference: BString, action: &'static str },
#[error("HEAD has {available} prior checkouts and checkout number {desired} is out of range")]
Expand Down
19 changes: 19 additions & 0 deletions git-repository/tests/revision/spec/from_bytes/mod.rs
Expand Up @@ -11,6 +11,25 @@ mod regex;
mod reflog;
mod traverse;

mod sibling_branch {
use crate::revision::spec::from_bytes::{parse_spec_no_baseline, repo};
use git_repository::revision::spec::parse::Error;

#[test]
fn is_planned_and_delayed_until_remotes_are_sorted() {
let repo = repo("complex_graph").unwrap();
assert!(matches!(
parse_spec_no_baseline("main@{push}", &repo).unwrap_err(),
Error::Planned { .. }
));

assert!(matches!(
parse_spec_no_baseline("main@{upstream}", &repo).unwrap_err(),
Error::Planned { .. }
));
}
}

mod index {
use crate::revision::spec::from_bytes::{parse_spec, repo};
use git_repository::prelude::ObjectIdExt;
Expand Down

0 comments on commit 145631b

Please sign in to comment.