History

[commitgraph] Remove `Kind` enum.

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.

Conor Davis committed 6 years ago

Commit 3c927611 parent 36953e03 files · +1 −29Browse files

Showing the changes to git-commitgraph/src (3 of 3 files). Show all

Unified · Split

3 files
  1. git-commitgraph/src/graph/init.rs +0 −18
  2. git-commitgraph/src/graph_file/access.rs +1 −5
  3. git-commitgraph/src/graph_file/mod.rs +0 −6
git-commitgraph/src/graph/init.rs+0−18
@@ -34,16 +34,6 @@ quick_error! { · 33 unmodified lines
34 MAX_COMMITS,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 for window in files.windows(2) {72 for window in files.windows(2) {
83 let f1 = &window[0];73 let f1 = &window[0];
84 let f2 = &window[1];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 if f1.hash_kind() != f2.hash_kind() {75 if f1.hash_kind() != f2.hash_kind() {
94 return Err(Error::HashVersionMismatch(76 return Err(Error::HashVersionMismatch(
95 f1.path().to_owned(),77 f1.path().to_owned(),
git-commitgraph/src/graph_file/access.rs+1−5
@@ -1,4 +1,4 @@
1use crate::graph_file::{Kind, LexPosition, COMMIT_DATA_ENTRY_SIZE};1use crate::graph_file::{LexPosition, COMMIT_DATA_ENTRY_SIZE};
2use crate::{CommitData, GraphFile};2use crate::{CommitData, GraphFile};
3use git_object::{borrowed, HashKind, SHA1_SIZE};3use git_object::{borrowed, HashKind, SHA1_SIZE};
4use std::convert::{TryFrom, TryInto};4use std::convert::{TryFrom, TryInto};
@@ -57,10 +57,6 @@ impl GraphFile { · 52 unmodified lines
57 (0..self.num_commits()).map(move |i| self.id_at(LexPosition(i)))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 // copied from git-odb/src/pack/index/access.rs60 // copied from git-odb/src/pack/index/access.rs
65 pub fn lookup(&self, id: borrowed::Id) -> Option<LexPosition> {61 pub fn lookup(&self, id: borrowed::Id) -> Option<LexPosition> {
66 let first_byte = id.first_byte() as usize;62 let first_byte = id.first_byte() as usize;
git-commitgraph/src/graph_file/mod.rs+0−6
@@ -45,9 +45,3 @@ impl Display for LexPosition { · 44 unmodified lines
45 self.0.fmt(f)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)]
51pub enum Kind {
52 V1,
53}

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t