diff --git a/Cargo.lock b/Cargo.lock index 38972efb29..e3ca08b02c 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1534,6 +1534,7 @@ dependencies = [ name = "git-revision" version = "0.2.0" dependencies = [ + "bstr", "git-hash", "git-object", "git-repository", diff --git a/git-revision/Cargo.toml b/git-revision/Cargo.toml index 76d447bc4b..d1b8d2b040 100644 --- a/git-revision/Cargo.toml +++ b/git-revision/Cargo.toml @@ -20,6 +20,7 @@ serde1 = [ "serde", "git-hash/serde1", "git-object/serde1" ] git-hash = { version = "^0.9.4", path = "../git-hash" } git-object = { version = "^0.19.0", path = "../git-object" } +bstr = { version = "0.2.13", default-features = false, features = ["std"]} hash_hasher = "2.0.3" thiserror = "1.0.26" serde = { version = "1.0.114", optional = true, default-features = false, features = ["derive"] } diff --git a/git-revision/src/describe.rs b/git-revision/src/describe.rs index 6c355cc23c..fc54d5bd26 100644 --- a/git-revision/src/describe.rs +++ b/git-revision/src/describe.rs @@ -3,7 +3,7 @@ use std::{ fmt::{Display, Formatter}, }; -use git_object::bstr::BStr; +use bstr::BStr; /// The positive result produced by [describe()][function::describe()]. #[derive(Debug, Clone)] @@ -150,8 +150,9 @@ pub(crate) mod function { iter::FromIterator, }; + use bstr::BStr; use git_hash::oid; - use git_object::{bstr::BStr, CommitRefIter}; + use git_object::CommitRefIter; use hash_hasher::HashBuildHasher; use super::{Error, Outcome}; diff --git a/git-revision/src/spec.rs b/git-revision/src/spec.rs index 5563f527d1..65e73bcca5 100644 --- a/git-revision/src/spec.rs +++ b/git-revision/src/spec.rs @@ -18,7 +18,7 @@ impl Default for Kind { pub mod parse { #![allow(missing_docs)] - use git_object::bstr::BStr; + use bstr::BStr; #[derive(Debug, thiserror::Error)] pub enum Error { @@ -49,11 +49,9 @@ pub mod parse { pub(crate) mod function { use crate::spec::parse::{Delegate, Error}; - use git_object::bstr::BStr; + use bstr::BStr; pub fn parse(input: &BStr, delegate: &mut impl Delegate) -> Result<(), Error> { - // TODO: don't hardcode these cases, see how git does it. This remains - // just an example. if input == "@" || input == "HEAD" { return delegate.resolve_ref("HEAD".into()).ok_or(Error::Delegate); }