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
163 use anyhow::Context;163 use anyhow::Context;
164 164
165 let path = pack_path.as_ref();165 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/O166 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, hash_kind).with_context(|| {167 let bundle = pack::Bundle::at(path, object_hash).with_context(|| {
168 format!(168 format!(
169 "Could not find .idx or .pack file from given file at '{}'",169 "Could not find .idx or .pack file from given file at '{}'",
170 path.display()170 path.display()
@@ -199,8 +199,8 @@ pub fn pack_or_pack_index( · 28 unmodified lines
199 {199 {
200 let object_path = object_path.map(|p| p.as_ref().to_owned());200 let object_path = object_path.map(|p| p.as_ref().to_owned());
201 move || {201 move || {
202 let out = OutputWriter::new(object_path.clone(), sink_compress, hash_kind);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, hash_kind)) } else { None };203 let object_verifier = if verify { object_path.as_ref().map(|path| loose::Store::at(path, object_hash)) } else { None };
204 let mut read_buf = Vec::new();204 let mut read_buf = Vec::new();
205 move |object_kind, buf, index_entry, progress| {205 move |object_kind, buf, index_entry, progress| {
206 let written_id = out.write_buf(object_kind, buf).map_err(|err| {206 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
128 path.display()128 path.display()
129 )129 )
130 })?;130 })?;
131 let hash_kind = git_repository::hash::Kind::Sha1; // TODO: make it configurable via Context/CLI131 let object_hash = git_repository::hash::Kind::Sha1; // TODO: make it configurable via Context/CLI
132 let res = match ext {132 let res = match ext {
133 "pack" => {133 "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")?;
135 pack.verify_checksum(135 pack.verify_checksum(
136 progress::DoOrDiscard::from(progress).add_child("Sha1 of pack"),136 progress::DoOrDiscard::from(progress).add_child("Sha1 of pack"),
137 &should_interrupt,137 &should_interrupt,
@@ -139,9 +139,10 @@ where · 1 unmodified line
139 .map(|id| (id, None))?139 .map(|id| (id, None))?
140 }140 }
141 "idx" => {141 "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")?;
143 let packfile_path = path.with_extension("pack");144 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)
145 .map_err(|e| {146 .map_err(|e| {
146 writeln!(147 writeln!(
147 err,148 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