Applied via `make rustfmt`, which enables these nightly-only rules: ``` group_imports = "StdExternalCrate" imports_granularity = "Crate" ``` Keep git-config in its original form for now
Showing the changes to git-commitgraph (10 of 275 files). Show all
Unified · Split
| @@ -1,11 +1,13 @@ | |||
| 1 | use crate::file::{self, commit::Commit, File, COMMIT_DATA_ENTRY_SIZE}; | ||
| 2 | use git_hash::SIZE_OF_SHA1_DIGEST as SHA1_SIZE; | ||
| 3 | use std::{ | 1 | use std::{ |
| 4 | convert::TryInto, | 2 | convert::TryInto, |
| 5 | fmt::{Debug, Formatter}, | 3 | fmt::{Debug, Formatter}, |
| 6 | path::Path, | 4 | path::Path, |
| 7 | }; | 5 | }; |
| 8 | 6 | ||
| 7 | use git_hash::SIZE_OF_SHA1_DIGEST as SHA1_SIZE; | ||
| 8 | |||
| 9 | use crate::file::{self, commit::Commit, File, COMMIT_DATA_ENTRY_SIZE}; | ||
| 10 | |||
| 9 | /// Access | 11 | /// Access |
| 10 | impl File { | 12 | impl File { |
| 11 | /// The number of base graphs that this file depends on. | 13 | /// The number of base graphs that this file depends on. |
| @@ -1,16 +1,18 @@ | |||
| 1 | //! Low-level operations on individual commits. | 1 | //! Low-level operations on individual commits. |
| 2 | use crate::{ | ||
| 3 | file::{self, File}, | ||
| 4 | graph, | ||
| 5 | }; | ||
| 6 | use byteorder::{BigEndian, ByteOrder}; | ||
| 7 | use git_hash::SIZE_OF_SHA1_DIGEST as SHA1_SIZE; | ||
| 8 | use std::{ | 2 | use std::{ |
| 9 | convert::TryInto, | 3 | convert::TryInto, |
| 10 | fmt::{Debug, Formatter}, | 4 | fmt::{Debug, Formatter}, |
| 11 | slice::Chunks, | 5 | slice::Chunks, |
| 12 | }; | 6 | }; |
| 13 | 7 | ||
| 8 | use byteorder::{BigEndian, ByteOrder}; | ||
| 9 | use git_hash::SIZE_OF_SHA1_DIGEST as SHA1_SIZE; | ||
| 10 | |||
| 11 | use crate::{ | ||
| 12 | file::{self, File}, | ||
| 13 | graph, | ||
| 14 | }; | ||
| 15 | |||
| 14 | /// The error used in the [`file::commit`][self] module. | 16 | /// The error used in the [`file::commit`][self] module. |
| 15 | #[derive(thiserror::Error, Debug)] | 17 | #[derive(thiserror::Error, Debug)] |
| 16 | #[allow(missing_docs)] | 18 | #[allow(missing_docs)] |
| @@ -1,14 +1,16 @@ | |||
| 1 | use crate::file::{File, COMMIT_DATA_ENTRY_SIZE, FAN_LEN, SIGNATURE}; | ||
| 2 | use bstr::ByteSlice; | ||
| 3 | use byteorder::{BigEndian, ByteOrder}; | ||
| 4 | use filebuffer::FileBuffer; | ||
| 5 | use git_hash::SIZE_OF_SHA1_DIGEST as SHA1_SIZE; | ||
| 6 | use std::{ | 1 | use std::{ |
| 7 | convert::{TryFrom, TryInto}, | 2 | convert::{TryFrom, TryInto}, |
| 8 | ops::Range, | 3 | ops::Range, |
| 9 | path::Path, | 4 | path::Path, |
| 10 | }; | 5 | }; |
| 11 | 6 | ||
| 7 | use bstr::ByteSlice; | ||
| 8 | use byteorder::{BigEndian, ByteOrder}; | ||
| 9 | use filebuffer::FileBuffer; | ||
| 10 | use git_hash::SIZE_OF_SHA1_DIGEST as SHA1_SIZE; | ||
| 11 | |||
| 12 | use crate::file::{File, COMMIT_DATA_ENTRY_SIZE, FAN_LEN, SIGNATURE}; | ||
| 13 | |||
| 12 | type ChunkId = [u8; 4]; | 14 | type ChunkId = [u8; 4]; |
| 13 | 15 | ||
| 14 | /// The error used in [`File::at()`]. | 16 | /// The error used in [`File::at()`]. |
| @@ -8,16 +8,16 @@ pub use commit::Commit; · 7 unmodified lines | |||
| 8 | mod init; | 8 | mod init; |
| 9 | pub mod verify; | 9 | pub mod verify; |
| 10 | 10 | ||
| 11 | pub use init::Error; | ||
| 12 | |||
| 13 | use filebuffer::FileBuffer; | ||
| 14 | use git_hash::SIZE_OF_SHA1_DIGEST as SHA1_SIZE; | ||
| 15 | use std::{ | 11 | use std::{ |
| 16 | fmt::{Display, Formatter}, | 12 | fmt::{Display, Formatter}, |
| 17 | ops::Range, | 13 | ops::Range, |
| 18 | path::PathBuf, | 14 | path::PathBuf, |
| 19 | }; | 15 | }; |
| 20 | 16 | ||
| 17 | use filebuffer::FileBuffer; | ||
| 18 | use git_hash::SIZE_OF_SHA1_DIGEST as SHA1_SIZE; | ||
| 19 | pub use init::Error; | ||
| 20 | |||
| 21 | const COMMIT_DATA_ENTRY_SIZE: usize = SHA1_SIZE + 16; | 21 | const COMMIT_DATA_ENTRY_SIZE: usize = SHA1_SIZE + 16; |
| 22 | const FAN_LEN: usize = 256; | 22 | const FAN_LEN: usize = 256; |
| 23 | const SIGNATURE: &[u8] = b"CGPH"; | 23 | const SIGNATURE: &[u8] = b"CGPH"; |
| @@ -1,16 +1,18 @@ | |||
| 1 | //! Auxiliary types used in commit graph file verification methods. | 1 | //! Auxiliary types used in commit graph file verification methods. |
| 2 | use crate::{ | ||
| 3 | file::{self, File}, | ||
| 4 | GENERATION_NUMBER_INFINITY, GENERATION_NUMBER_MAX, | ||
| 5 | }; | ||
| 6 | use bstr::ByteSlice; | ||
| 7 | use git_hash::SIZE_OF_SHA1_DIGEST as SHA1_SIZE; | ||
| 8 | use std::{ | 2 | use std::{ |
| 9 | cmp::{max, min}, | 3 | cmp::{max, min}, |
| 10 | collections::HashMap, | 4 | collections::HashMap, |
| 11 | path::Path, | 5 | path::Path, |
| 12 | }; | 6 | }; |
| 13 | 7 | ||
| 8 | use bstr::ByteSlice; | ||
| 9 | use git_hash::SIZE_OF_SHA1_DIGEST as SHA1_SIZE; | ||
| 10 | |||
| 11 | use crate::{ | ||
| 12 | file::{self, File}, | ||
| 13 | GENERATION_NUMBER_INFINITY, GENERATION_NUMBER_MAX, | ||
| 14 | }; | ||
| 15 | |||
| 14 | /// The error used in [`File::traverse()`]. | 16 | /// The error used in [`File::traverse()`]. |
| 15 | #[derive(thiserror::Error, Debug)] | 17 | #[derive(thiserror::Error, Debug)] |
| 16 | #[allow(missing_docs)] | 18 | #[allow(missing_docs)] |
| @@ -1,13 +1,14 @@ | |||
| 1 | use crate::{ | ||
| 2 | file::{self, File}, | ||
| 3 | Graph, MAX_COMMITS, | ||
| 4 | }; | ||
| 5 | use std::{ | 1 | use std::{ |
| 6 | convert::TryFrom, | 2 | convert::TryFrom, |
| 7 | io::{BufRead, BufReader}, | 3 | io::{BufRead, BufReader}, |
| 8 | path::{Path, PathBuf}, | 4 | path::{Path, PathBuf}, |
| 9 | }; | 5 | }; |
| 10 | 6 | ||
| 7 | use crate::{ | ||
| 8 | file::{self, File}, | ||
| 9 | Graph, MAX_COMMITS, | ||
| 10 | }; | ||
| 11 | |||
| 11 | /// The error used in the [`graph`][crate::graph] module. | 12 | /// The error used in the [`graph`][crate::graph] module. |
| 12 | #[derive(thiserror::Error, Debug)] | 13 | #[derive(thiserror::Error, Debug)] |
| 13 | #[allow(missing_docs)] | 14 | #[allow(missing_docs)] |
| @@ -3,9 +3,10 @@ mod access; · 2 unmodified lines | |||
| 3 | mod init; | 3 | mod init; |
| 4 | pub mod verify; | 4 | pub mod verify; |
| 5 | 5 | ||
| 6 | use crate::file::File; | ||
| 7 | use std::fmt; | 6 | use std::fmt; |
| 8 | 7 | ||
| 8 | use crate::file::File; | ||
| 9 | |||
| 9 | /// A complete commit graph. | 10 | /// A complete commit graph. |
| 10 | /// | 11 | /// |
| 11 | /// The data in the commit graph may come from a monolithic `objects/info/commit-graph` file, or it | 12 | /// The data in the commit graph may come from a monolithic `objects/info/commit-graph` file, or it |
| @@ -1,8 +1,4 @@ | |||
| 1 | //! Auxiliary types used by graph verification methods. | 1 | //! Auxiliary types used by graph verification methods. |
| 2 | use crate::{ | ||
| 3 | file::{self, commit}, | ||
| 4 | graph, Graph, GENERATION_NUMBER_MAX, | ||
| 5 | }; | ||
| 6 | use std::{ | 2 | use std::{ |
| 7 | cmp::{max, min}, | 3 | cmp::{max, min}, |
| 8 | collections::BTreeMap, | 4 | collections::BTreeMap, |
| @@ -10,6 +6,11 @@ use std::{ · 1 unmodified line | |||
| 10 | path::PathBuf, | 6 | path::PathBuf, |
| 11 | }; | 7 | }; |
| 12 | 8 | ||
| 9 | use crate::{ | ||
| 10 | file::{self, commit}, | ||
| 11 | graph, Graph, GENERATION_NUMBER_MAX, | ||
| 12 | }; | ||
| 13 | |||
| 13 | /// The error used in [`verify_integrity()`][Graph::verify_integrity]. | 14 | /// The error used in [`verify_integrity()`][Graph::verify_integrity]. |
| 14 | #[derive(thiserror::Error, Debug)] | 15 | #[derive(thiserror::Error, Debug)] |
| 15 | #[allow(missing_docs)] | 16 | #[allow(missing_docs)] |
| @@ -1,6 +1,7 @@ | |||
| 1 | use crate::{check_common, inspect_refs, make_readonly_repo}; | ||
| 2 | use git_commitgraph::Graph; | 1 | use git_commitgraph::Graph; |
| 3 | 2 | ||
| 3 | use crate::{check_common, inspect_refs, make_readonly_repo}; | ||
| 4 | |||
| 4 | #[test] | 5 | #[test] |
| 5 | fn single_parent() -> crate::Result { | 6 | fn single_parent() -> crate::Result { |
| 6 | let repo_dir = make_readonly_repo("single_parent.sh"); | 7 | let repo_dir = make_readonly_repo("single_parent.sh"); |
| @@ -1,4 +1,3 @@ | |||
| 1 | use git_commitgraph::{graph::Position as GraphPosition, Graph}; | ||
| 2 | use std::{ | 1 | use std::{ |
| 3 | collections::{HashMap, HashSet}, | 2 | collections::{HashMap, HashSet}, |
| 4 | convert::{TryFrom, TryInto}, | 3 | convert::{TryFrom, TryInto}, |
| @@ -8,6 +7,8 @@ use std::{ · 3 unmodified lines | |||
| 8 | process::Command, | 7 | process::Command, |
| 9 | }; | 8 | }; |
| 10 | 9 | ||
| 10 | use git_commitgraph::{graph::Position as GraphPosition, Graph}; | ||
| 11 | |||
| 11 | type Result = std::result::Result<(), Box<dyn std::error::Error>>; | 12 | type Result = std::result::Result<(), Box<dyn std::error::Error>>; |
| 12 | 13 | ||
| 13 | mod access; | 14 | mod access; |