History

refactor (#279)

Sebastian Thiel committed 4 years ago

Commit 005fba71 parent 2ef9a842 files · +9 −8Browse files

Unified · Split

2 files
  1. gitoxide-core/src/pack/explode.rs +4 −4
  2. gitoxide-core/src/pack/verify.rs +5 −4
gitoxide-core/src/pack/explode.rs+4−4
@@ -163,8 +163,8 @@ pub fn pack_or_pack_index( · 162 unmodified lines
163163 use anyhow::Context;
164164
165165 let path = pack_path.as_ref();
166− let hash_kind = git_repository::hash::Kind::Sha1; // TODO: make this configurable via CLI, maybe even different values for I/O
167− let bundle = pack::Bundle::at(path, hash_kind).with_context(|| {
166+ let object_hash = git_repository::hash::Kind::Sha1; // TODO: make this configurable via CLI, maybe even different values for I/O
167+ let bundle = pack::Bundle::at(path, object_hash).with_context(|| {
168168 format!(
169169 "Could not find .idx or .pack file from given file at '{}'",
170170 path.display()
@@ -199,8 +199,8 @@ pub fn pack_or_pack_index( · 28 unmodified lines
199199 {
200200 let object_path = object_path.map(|p| p.as_ref().to_owned());
201201 move || {
202− let out = OutputWriter::new(object_path.clone(), sink_compress, hash_kind);
203− let object_verifier = if verify { object_path.as_ref().map(|path| loose::Store::at(path, hash_kind)) } else { None };
202+ let out = OutputWriter::new(object_path.clone(), sink_compress, object_hash);
203+ let object_verifier = if verify { object_path.as_ref().map(|path| loose::Store::at(path, object_hash)) } else { None };
204204 let mut read_buf = Vec::new();
205205 move |object_kind, buf, index_entry, progress| {
206206 let written_id = out.write_buf(object_kind, buf).map_err(|err| {
gitoxide-core/src/pack/verify.rs+5−4
@@ -128,10 +128,10 @@ where · 127 unmodified lines
128128 path.display()
129129 )
130130 })?;
131− let hash_kind = git_repository::hash::Kind::Sha1; // TODO: make it configurable via Context/CLI
131+ let object_hash = git_repository::hash::Kind::Sha1; // TODO: make it configurable via Context/CLI
132132 let res = match ext {
133133 "pack" => {
134− let pack = odb::pack::data::File::at(path, hash_kind).with_context(|| "Could not open pack file")?;
134+ let pack = odb::pack::data::File::at(path, object_hash).with_context(|| "Could not open pack file")?;
135135 pack.verify_checksum(
136136 progress::DoOrDiscard::from(progress).add_child("Sha1 of pack"),
137137 &should_interrupt,
@@ -139,9 +139,10 @@ where · 1 unmodified line
139139 .map(|id| (id, None))?
140140 }
141141 "idx" => {
142− let idx = odb::pack::index::File::at(path, hash_kind).with_context(|| "Could not open pack index file")?;
142+ let idx =
143+ odb::pack::index::File::at(path, object_hash).with_context(|| "Could not open pack index file")?;
143144 let packfile_path = path.with_extension("pack");
144− let pack = odb::pack::data::File::at(&packfile_path, hash_kind)
145+ let pack = odb::pack::data::File::at(&packfile_path, object_hash)
145146 .map_err(|e| {
146147 writeln!(
147148 err,

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