-
-
Notifications
You must be signed in to change notification settings - Fork 313
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Basic multi-pack index creation (#279)
Could imagine providing statistics as part of the creation result.
- Loading branch information
Showing
7 changed files
with
117 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
use git_repository::Progress; | ||
use std::io::BufWriter; | ||
use std::path::PathBuf; | ||
use std::sync::atomic::AtomicBool; | ||
|
||
use git_repository as git; | ||
|
||
pub const PROGRESS_RANGE: std::ops::RangeInclusive<u8> = 2..=3; | ||
|
||
pub fn create( | ||
index_paths: Vec<PathBuf>, | ||
output_path: PathBuf, | ||
progress: impl Progress, | ||
should_interrupt: &AtomicBool, | ||
object_hash: git::hash::Kind, | ||
) -> anyhow::Result<()> { | ||
let mut out = BufWriter::new(git::lock::File::acquire_to_update_resource( | ||
output_path, | ||
git::lock::acquire::Fail::Immediately, | ||
None, | ||
)?); | ||
git::odb::pack::multi_index::File::write_from_index_paths( | ||
index_paths, | ||
&mut out, | ||
progress, | ||
should_interrupt, | ||
git::odb::pack::multi_index::write::Options { object_hash }, | ||
)?; | ||
out.into_inner()?.commit()?; | ||
Ok(()) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters