History

[pack] write packs to a directory with the proper name

Sebastian Thiel committed 5 years ago

Commit 3fbca7d1 parent f10adea8 files · +31 −25Browse files

Showing the changes to src (4 of 8 files). Show all

Unified · Split

4 files
  1. src/plumbing/lean/main.rs +2 −7
  2. src/plumbing/lean/options.rs +4 −0
  3. src/plumbing/pretty/main.rs +3 −14
  4. src/plumbing/pretty/options.rs +4 −0
src/plumbing/lean/main.rs+2−7
@@ -22,15 +22,10 @@ pub fn main() -> Result<()> { · 21 unmodified lines
2222 repository,
2323 expansion,
2424 tips,
25+ output_directory,
2526 }) => {
2627 let (_handle, progress) = prepare(verbose, "pack-create", Some(core::pack::create::PROGRESS_RANGE));
2728 let has_tips = !tips.is_empty();
28− let stdout = stdout();
29− let stdout_lock = stdout.lock();
30− #[cfg(feature = "atty")]
31− if atty::is(atty::Stream::Stdout) {
32− anyhow::bail!("Refusing to output pack data stream to stdout.")
33− }
3429 let input = if has_tips {
3530 None
3631 } else {
@@ -51,7 +46,7 @@ pub fn main() -> Result<()> { · 14 unmodified lines
5146 repository.unwrap_or_else(|| PathBuf::from(".")),
5247 tips,
5348 input,
54− stdout_lock,
49+ output_directory,
5550 DoOrDiscard::from(progress),
5651 core::pack::create::Context {
5752 expansion,
src/plumbing/lean/options.rs+4−0
@@ -176,6 +176,10 @@ pub struct PackCreate { · 175 unmodified lines
176176 /// Possible values are "none" and "tree-traversal". Default is "none".
177177 pub expansion: Option<core::pack::create::ObjectExpansion>,
178178
179+ /// the directory into which to write the pack file.
180+ #[argh(option, short = 'o')]
181+ pub output_directory: PathBuf,
182+
179183 /// the tips from which to start the commit graph iteration.
180184 ///
181185 /// If empty, we expect to read objects on stdin and default to 'none' as expansion mode.
src/plumbing/pretty/main.rs+3−14
@@ -28,23 +28,16 @@ pub fn main() -> Result<()> { · 27 unmodified lines
2828 repository,
2929 expansion,
3030 tips,
31+ output_directory,
3132 } => {
3233 let has_tips = !tips.is_empty();
33− let has_tui = progress;
34− if atty::is(if has_tui {
35− atty::Stream::Stderr
36− } else {
37− atty::Stream::Stdout
38− }) {
39− anyhow::bail!("Refusing to output pack data stream to stderr.")
40− }
4134 prepare_and_run(
4235 "pack-create",
4336 verbose,
4437 progress,
4538 progress_keep_open,
4639 core::pack::create::PROGRESS_RANGE,
47− move |progress, out, err| {
40+ move |progress, _out, _err| {
4841 let input = if has_tips {
4942 None
5043 } else {
@@ -67,11 +60,7 @@ pub fn main() -> Result<()> { · 16 unmodified lines
6760 }),
6861 };
6962 let progress = git_features::progress::DoOrDiscard::from(progress);
70− if has_tui {
71− core::pack::create(repository, tips, input, err, progress, context)
72− } else {
73− core::pack::create(repository, tips, input, out, progress, context)
74− }
63+ core::pack::create(repository, tips, input, output_directory, progress, context)
7564 },
7665 )
7766 }
src/plumbing/pretty/options.rs+4−0
@@ -56,6 +56,10 @@ pub enum Subcommands { · 55 unmodified lines
5656 /// Possible values are "none" and "tree-traversal". Default is "none".
5757 expansion: Option<core::pack::create::ObjectExpansion>,
5858
59+ /// The directory into which to write the pack file.
60+ #[clap(long, short = 'o')]
61+ output_directory: PathBuf,
62+
5963 /// the tips from which to start the commit graph iteration.
6064 ///
6165 /// If empty, we expect to read objects on stdin and default to 'none' as expansion mode.