Commit-graph files only have one version for now, so no need to indicate file versions. Still return an error if attempting to parse a file that is not at version 1.
Showing the changes to git-commitgraph/src (3 of 3 files). Show all
Unified · Split
| @@ -34,16 +34,6 @@ quick_error! { · 33 unmodified lines | ||
| 34 | 34 | MAX_COMMITS, |
| 35 | 35 | ) |
| 36 | 36 | } |
| 37 | − // This might actually be legal... | |
| 38 | − VersionMismatch(path1: PathBuf, version1: graph_file::Kind, path2: PathBuf, version2: graph_file::Kind) { | |
| 39 | − display( | |
| 40 | − "Commit-graph files mismatch: '{}' is version {:?}, but '{}' is version {:?}", | |
| 41 | − path1.display(), | |
| 42 | − version1, | |
| 43 | − path2.display(), | |
| 44 | − version2, | |
| 45 | − ) | |
| 46 | − } | |
| 47 | 37 | } |
| 48 | 38 | } |
| 49 | 39 | |
| @@ -82,14 +72,6 @@ impl Graph { · 32 unmodified lines | ||
| 82 | 72 | for window in files.windows(2) { |
| 83 | 73 | let f1 = &window[0]; |
| 84 | 74 | let f2 = &window[1]; |
| 85 | − if f1.kind() != f2.kind() { | |
| 86 | − return Err(Error::VersionMismatch( | |
| 87 | − f1.path().to_owned(), | |
| 88 | − f1.kind(), | |
| 89 | − f2.path().to_owned(), | |
| 90 | − f2.kind(), | |
| 91 | − )); | |
| 92 | − } | |
| 93 | 75 | if f1.hash_kind() != f2.hash_kind() { |
| 94 | 76 | return Err(Error::HashVersionMismatch( |
| 95 | 77 | f1.path().to_owned(), |
| @@ -1,4 +1,4 @@ | ||
| 1 | −use crate::graph_file::{Kind, LexPosition, COMMIT_DATA_ENTRY_SIZE}; | |
| 1 | +use crate::graph_file::{LexPosition, COMMIT_DATA_ENTRY_SIZE}; | |
| 2 | 2 | use crate::{CommitData, GraphFile}; |
| 3 | 3 | use git_object::{borrowed, HashKind, SHA1_SIZE}; |
| 4 | 4 | use std::convert::{TryFrom, TryInto}; |
| @@ -57,10 +57,6 @@ impl GraphFile { · 52 unmodified lines | ||
| 57 | 57 | (0..self.num_commits()).map(move |i| self.id_at(LexPosition(i))) |
| 58 | 58 | } |
| 59 | 59 | |
| 60 | − pub fn kind(&self) -> Kind { | |
| 61 | − Kind::V1 | |
| 62 | − } | |
| 63 | − | |
| 64 | 60 | // copied from git-odb/src/pack/index/access.rs |
| 65 | 61 | pub fn lookup(&self, id: borrowed::Id) -> Option<LexPosition> { |
| 66 | 62 | let first_byte = id.first_byte() as usize; |
| @@ -45,9 +45,3 @@ impl Display for LexPosition { · 44 unmodified lines | ||
| 45 | 45 | self.0.fmt(f) |
| 46 | 46 | } |
| 47 | 47 | } |
| 48 | − | |
| 49 | −/// The version of a commit graph file. | |
| 50 | −#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)] | |
| 51 | −pub enum Kind { | |
| 52 | − V1, | |
| 53 | −} | |