Skip to content

Commit

Permalink
refactor (#427)
Browse files Browse the repository at this point in the history
  • Loading branch information
Byron committed May 29, 2022
1 parent 7136c9e commit 67162ba
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 6 deletions.
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions git-revision/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"] }
Expand Down
5 changes: 3 additions & 2 deletions git-revision/src/describe.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)]
Expand Down Expand Up @@ -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};
Expand Down
6 changes: 2 additions & 4 deletions git-revision/src/spec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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);
}
Expand Down

0 comments on commit 67162ba

Please sign in to comment.