Skip to content

git-object refactor #177

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 18 commits into from
Aug 26, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
[object #177] tag::RefIter -> TagRefIter
  • Loading branch information
Byron committed Aug 26, 2021
commit 28587c691eb74e5cb097afb2b63f9d9e2561c45d
6 changes: 2 additions & 4 deletions git-object/src/blob.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
use crate::Blob;
use crate::BlobRef;
use std::{convert::Infallible, io};

use std::convert::Infallible;
use std::io;
use crate::{Blob, BlobRef};

impl Blob {
/// Write the blobs data to `out` verbatim.
Expand Down
3 changes: 0 additions & 3 deletions git-object/src/immutable/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,4 @@ pub mod commit;
///
pub mod object;

///
pub mod tag;

pub(crate) mod parse;
277 changes: 0 additions & 277 deletions git-object/src/immutable/tag.rs

This file was deleted.

10 changes: 8 additions & 2 deletions git-object/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,10 @@ use std::borrow::Cow;
pub use bstr;
use bstr::{BStr, BString, ByteSlice};
use smallvec::SmallVec;

use tree::Entry;
pub use types::{Error, Kind};

use crate::tree::EntryRef;
use tree::Entry;

pub mod immutable;
pub mod mutable;
Expand Down Expand Up @@ -117,6 +116,13 @@ pub struct TagRef<'a> {
pub pgp_signature: Option<&'a BStr>,
}

/// Like [`TagRef`], but as `Iterator` to support entirely allocation free parsing.
/// It's particularly useful to dereference only the target chain.
pub struct TagRefIter<'a> {
data: &'a [u8],
state: tag::ref_iter::State,
}

/// A mutable git tag.
#[derive(PartialEq, Eq, Debug, Hash, Ord, PartialOrd, Clone)]
#[cfg_attr(feature = "serde1", derive(serde::Serialize, serde::Deserialize))]
Expand Down
3 changes: 1 addition & 2 deletions git-object/src/mutable/object.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,7 @@ impl Object {
mod convert {
use std::convert::TryFrom;

use crate::Object;
use crate::{Blob, Commit, Tag, Tree};
use crate::{Blob, Commit, Object, Tag, Tree};

impl From<Tag> for Object {
fn from(v: Tag) -> Self {
Expand Down
6 changes: 4 additions & 2 deletions git-object/src/mutable/tag.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,10 @@ use std::io;
use bstr::BStr;
use quick_error::quick_error;

use crate::mutable::{encode, NL};
use crate::Tag;
use crate::{
mutable::{encode, NL},
Tag,
};

quick_error! {
/// An Error used in [`Tag::write_to()`].
Expand Down
1 change: 0 additions & 1 deletion git-object/src/tag.rs

This file was deleted.

Loading