Skip to content

Commit

Permalink
add missing docs (#279)
Browse files Browse the repository at this point in the history
  • Loading branch information
Byron committed Jan 1, 2022
1 parent 1bea1d4 commit 4137327
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 18 deletions.
3 changes: 1 addition & 2 deletions cargo-smart-release/src/commit/message.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
use git_conventional::Type;
use git_repository as git;
use git_repository::bstr::{BStr, ByteSlice};
use git_repository::bstr::ByteSlice;

use crate::commit::Message;

Expand Down
6 changes: 2 additions & 4 deletions cargo-smart-release/src/commit/mod.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
#![allow(unused)]

use std::{borrow::Cow, collections::HashMap};
use std::collections::HashMap;

use git_repository as git;

Expand All @@ -19,7 +17,7 @@ pub struct Message {
pub breaking: bool,
/// If set, this commit message body contains a specific description of the breaking change.
pub breaking_description: Option<String>,
/// all dditional information parsed from the title.
/// all additional information parsed from the title.
pub additions: Vec<message::Addition>,
}

Expand Down
2 changes: 1 addition & 1 deletion git-odb/src/store_impls/dynamic/load_index.rs
Original file line number Diff line number Diff line change
Expand Up @@ -457,7 +457,7 @@ impl super::Store {
}

/// returns Ok<dest slot was empty> if the copy could happen because dest-slot was actually free or disposable , and Some(true) if it was empty
#[allow(clippy::too_many_arguments, unused_variables)]
#[allow(clippy::too_many_arguments)]
fn try_set_index_slot(
lock: &parking_lot::MutexGuard<'_, ()>,
dest_slot: &MutableIndexAndPack,
Expand Down
9 changes: 3 additions & 6 deletions git-odb/tests/odb/store/dynamic.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
#![allow(unused)]

use std::process::Command;

use git_features::threading::OwnShared;
use git_odb::{store, Find, FindExt, Write};
use git_testtools::{fixture_path, hex_to_id};

Expand Down Expand Up @@ -132,7 +129,7 @@ fn multi_index_keep_open() -> crate::Result {
"it opened the multi-pack index for iteration"
);
let mut buf = Vec::new();
use git_pack::{Find, FindExt};
use git_pack::Find;
let location = stable_handle
.location_by_oid(oid, &mut buf)
.expect("oid exists and is packed");
Expand Down Expand Up @@ -182,7 +179,7 @@ fn write() -> crate::Result {

#[test]
fn contains() {
let mut handle = db();
let handle = db();

assert!(handle.contains(hex_to_id("37d4e6c5c48ba0d245164c4e10d5f41140cab980"))); // loose object
assert_eq!(
Expand Down Expand Up @@ -497,7 +494,7 @@ fn auto_refresh_with_and_without_id_stability() -> crate::Result {
);

{
use git_pack::{Find, FindExt};
use git_pack::Find;
let mut stable_handle = handle.clone();
stable_handle.prevent_pack_unload();
let location = stable_handle
Expand Down
24 changes: 19 additions & 5 deletions git-pack/src/multi_index/write.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
#![allow(missing_docs, unused)]

use std::sync::atomic::Ordering;
use std::{
convert::TryInto,
io::Write,
path::PathBuf,
sync::atomic::AtomicBool,
time::{Instant, SystemTime},
Expand All @@ -16,6 +14,7 @@ use crate::multi_index;
mod error {
/// The error returned by [multi_index::File::write_from_index_paths()][super::multi_index::File::write_from_index_paths()]..
#[derive(Debug, thiserror::Error)]
#[allow(missing_docs)]
pub enum Error {
#[error(transparent)]
Io(#[from] std::io::Error),
Expand All @@ -36,10 +35,13 @@ pub(crate) struct Entry {
index_mtime: SystemTime,
}

/// Options for use in [`multi_index::File::write_from_index_paths()`].
pub struct Options {
/// The kind of hash to use for objects and to expect in the input files.
pub object_hash: git_hash::Kind,
}

/// The result of [`multi_index::File::write_from_index_paths()`].
pub struct Outcome<P> {
/// The calculated multi-index checksum of the file at `multi_index_path`.
pub multi_index_checksum: git_hash::ObjectId,
Expand All @@ -56,6 +58,9 @@ impl multi_index::File {
1 /*num base files */ +
4 /*num pack files*/;

/// Create a new multi-index file for writing to `out` from the pack index files at `index_paths`.
///
/// Progress is sent to `progress` and interruptions checked via `should_interrupt`.
pub fn write_from_index_paths<P>(
mut index_paths: Vec<PathBuf>,
out: impl std::io::Write,
Expand All @@ -66,7 +71,7 @@ impl multi_index::File {
where
P: Progress,
{
let mut out = git_features::hash::Write::new(out, object_hash);
let out = git_features::hash::Write::new(out, object_hash);
let (index_paths_sorted, index_filenames_sorted) = {
index_paths.sort();
let file_names = index_paths
Expand Down Expand Up @@ -98,6 +103,9 @@ impl multi_index::File {
index_mtime: mtime,
}));
progress.inc();
if should_interrupt.load(Ordering::Relaxed) {
return Err(Error::Interrupted);
}
}
progress.show_throughput(start);

Expand All @@ -111,6 +119,9 @@ impl multi_index::File {
});
entries.dedup_by_key(|e| e.id);
progress.show_throughput(start);
if should_interrupt.load(Ordering::Relaxed) {
return Err(Error::Interrupted);
}
entries
};

Expand Down Expand Up @@ -138,7 +149,7 @@ impl multi_index::File {
}

let mut write_progress = progress.add_child("Writing multi-index");
let mut write_start = Instant::now();
let write_start = Instant::now();
write_progress.init(
Some(cf.planned_storage_size() as usize + Self::HEADER_LEN),
git_features::progress::bytes(),
Expand Down Expand Up @@ -174,6 +185,9 @@ impl multi_index::File {
unknown => unreachable!("BUG: forgot to implement chunk {:?}", std::str::from_utf8(&unknown)),
}
progress.inc();
if should_interrupt.load(Ordering::Relaxed) {
return Err(Error::Interrupted);
}
}
}

Expand Down

0 comments on commit 4137327

Please sign in to comment.