Skip to content

Commit 524ce51

Browse files
committed
first round of git-object doc proof reading
1 parent 781c4cf commit 524ce51

File tree

9 files changed

+17
-14
lines changed

9 files changed

+17
-14
lines changed

git-object/src/borrowed/blob.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ pub struct Blob<'a> {
99
}
1010

1111
impl<'a> Blob<'a> {
12-
/// Instantiate a `Blob` from the given `data`
12+
/// Instantiate a `Blob` from the given `data`, which is used as-is.
1313
pub fn from_bytes(data: &[u8]) -> Result<Blob<'_>, Infallible> {
1414
Ok(Blob { data })
1515
}

git-object/src/borrowed/commit.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ use nom::{
1313
use smallvec::SmallVec;
1414
use std::borrow::Cow;
1515

16-
/// A shared git commit, created using [`from_bytes()`][Commit::from_bytes()].
16+
/// A git commit parsed using [`from_bytes()`][Commit::from_bytes()].
1717
///
1818
/// A commit encapsulates information about a point in time at which the state of the repository is recorded, usually after a
1919
/// change which is documented in the commit `message`.
@@ -47,7 +47,7 @@ impl<'a> Commit<'a> {
4747
pub fn from_bytes(data: &'a [u8]) -> Result<Commit<'a>, Error> {
4848
parse(data).map(|(_, t)| t).map_err(Error::from)
4949
}
50-
/// Return the `tree` fields hash.
50+
/// Return the `tree` fields hash digest.
5151
pub fn tree(&self) -> owned::Id {
5252
owned::Id::from_40_bytes_in_hex(self.tree).expect("prior validation")
5353
}

git-object/src/borrowed/id.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ use bstr::ByteSlice;
33
use std::convert::{TryFrom, TryInto};
44
use std::fmt;
55

6-
/// A borrowed reference to a hash identifying objects
6+
/// A borrowed reference to a hash identifying objects.
77
#[derive(PartialEq, Eq, Debug, Hash, Ord, PartialOrd, Clone, Copy)]
88
#[cfg_attr(feature = "serde1", derive(serde::Serialize))]
99
pub struct Id<'a>(&'a [u8; SHA1_SIZE]);

git-object/src/borrowed/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
//! Borrowed objects are read-only structures referencing most data in a byte based backing store.
1+
//! Borrowed objects are read-only structures referencing most data from a byte slice.
22
//!
33
//! Borrowed objects are expected to be deserialized from bytes that acts as backing store, and they
4-
//! cannot mutated or serialized. Instead, one will convert them into their `owned` counterparts,
4+
//! cannot be mutated or serialized. Instead, one will convert them into their [`owned`][crate::owned] counterparts
55
//! which support mutation and serialization.
66
mod commit;
77
pub use commit::Commit;

git-object/src/borrowed/tree.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ use nom::{
1010
};
1111
use std::convert::TryFrom;
1212

13-
/// A directory recording contained files (blobs), directories (trees) and submodules (commits).
13+
/// A directory snapshot containing files (blobs), directories (trees) and submodules (commits).
1414
#[derive(PartialEq, Eq, Debug, Hash, Ord, PartialOrd, Clone)]
1515
#[cfg_attr(feature = "serde1", derive(serde::Serialize, serde::Deserialize))]
1616
pub struct Tree<'a> {

git-object/src/lib.rs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
//! This crate provides types for [read-only git objects][borrowed::Object] backed by bytes provided in gits serialization format
2-
//! as well as [mutable versions][owned::Object] of these. The latter can be serialized into gits serialization format for objects.
1+
//! This crate provides types for [read-only git objects][borrowed::Object] backed by bytes provided in git's serialization format
2+
//! as well as [mutable versions][owned::Object] of these. The latter can be serialized into git's serialization format for objects.
33
#![forbid(unsafe_code)]
44
#![deny(rust_2018_idioms, missing_docs)]
55

@@ -8,13 +8,11 @@ use bstr::{BStr, BString, ByteSlice};
88
/// For convenience to allow using `bstr` without adding it to own cargo manifest
99
pub use bstr;
1010

11-
/// Objects sharing data with a backing store to minimize allocations
1211
pub mod borrowed;
13-
/// Mutable objects with each field being separately allocated and mutable.
1412
pub mod owned;
1513

1614
mod types;
17-
pub use types::*;
15+
pub use types::{tree, Error, Kind, Sign, Time, SHA1_SIZE};
1816

1917
///
2018
pub mod commit;

git-object/src/owned/mod.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
//! Mutable objects with each field being separately allocated and mutable.
2+
//!
13
//! Owned objects are Commits, Trees, Blobs and Tags that can be mutated and serialized.
24
35
pub(crate) const NL: &[u8; 1] = b"\n";

git-object/src/types.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ use crate::owned::SPACE;
22
use quick_error::quick_error;
33
use std::{fmt, io};
44

5-
/// Indicates if a number is positive or negative
5+
/// Indicates if a number is positive or negative for use in [`Time`].
66
#[derive(PartialEq, Eq, Debug, Hash, Ord, PartialOrd, Clone, Copy)]
77
#[cfg_attr(feature = "serde1", derive(serde::Serialize, serde::Deserialize))]
88
#[allow(missing_docs)]
@@ -56,7 +56,7 @@ impl Time {
5656
/// The size of a SHA1 hash digest in bytes
5757
pub const SHA1_SIZE: usize = 20;
5858

59-
/// The four types of objects that git differentiates
59+
/// The four types of objects that git differentiates.
6060
#[derive(PartialEq, Eq, Debug, Hash, Ord, PartialOrd, Clone, Copy)]
6161
#[cfg_attr(feature = "serde1", derive(serde::Serialize, serde::Deserialize))]
6262
#[allow(missing_docs)]

tasks.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@
33
* **git-odb**
44
* [x] all docs, sans examples
55
* [x] Rename pack data/pack index `Kind` to `Version` or similar, because that's what it really is.
6+
* **git-object** refactor
7+
* [ ] split `Id` and everything hash related into `git-id`
8+
* [ ] use `git-id` inside of `git-features`, remove cycle
69
* **Documentation (with deny(missing_docs))**
710
* [x] git-features
811
* [ ] git-object

0 commit comments

Comments
 (0)