Showing the changes to src (4 of 8 files). Show all
Unified · Split
| @@ -22,15 +22,10 @@ pub fn main() -> Result<()> { · 21 unmodified lines | ||
| 22 | 22 | repository, |
| 23 | 23 | expansion, |
| 24 | 24 | tips, |
| 25 | + output_directory, | |
| 25 | 26 | }) => { |
| 26 | 27 | let (_handle, progress) = prepare(verbose, "pack-create", Some(core::pack::create::PROGRESS_RANGE)); |
| 27 | 28 | 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 | − } | |
| 34 | 29 | let input = if has_tips { |
| 35 | 30 | None |
| 36 | 31 | } else { |
| @@ -51,7 +46,7 @@ pub fn main() -> Result<()> { · 14 unmodified lines | ||
| 51 | 46 | repository.unwrap_or_else(|| PathBuf::from(".")), |
| 52 | 47 | tips, |
| 53 | 48 | input, |
| 54 | − stdout_lock, | |
| 49 | + output_directory, | |
| 55 | 50 | DoOrDiscard::from(progress), |
| 56 | 51 | core::pack::create::Context { |
| 57 | 52 | expansion, |
| @@ -176,6 +176,10 @@ pub struct PackCreate { · 175 unmodified lines | ||
| 176 | 176 | /// Possible values are "none" and "tree-traversal". Default is "none". |
| 177 | 177 | pub expansion: Option<core::pack::create::ObjectExpansion>, |
| 178 | 178 | |
| 179 | + /// the directory into which to write the pack file. | |
| 180 | + #[argh(option, short = 'o')] | |
| 181 | + pub output_directory: PathBuf, | |
| 182 | + | |
| 179 | 183 | /// the tips from which to start the commit graph iteration. |
| 180 | 184 | /// |
| 181 | 185 | /// If empty, we expect to read objects on stdin and default to 'none' as expansion mode. |
| @@ -28,23 +28,16 @@ pub fn main() -> Result<()> { · 27 unmodified lines | ||
| 28 | 28 | repository, |
| 29 | 29 | expansion, |
| 30 | 30 | tips, |
| 31 | + output_directory, | |
| 31 | 32 | } => { |
| 32 | 33 | 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 | − } | |
| 41 | 34 | prepare_and_run( |
| 42 | 35 | "pack-create", |
| 43 | 36 | verbose, |
| 44 | 37 | progress, |
| 45 | 38 | progress_keep_open, |
| 46 | 39 | core::pack::create::PROGRESS_RANGE, |
| 47 | − move |progress, out, err| { | |
| 40 | + move |progress, _out, _err| { | |
| 48 | 41 | let input = if has_tips { |
| 49 | 42 | None |
| 50 | 43 | } else { |
| @@ -67,11 +60,7 @@ pub fn main() -> Result<()> { · 16 unmodified lines | ||
| 67 | 60 | }), |
| 68 | 61 | }; |
| 69 | 62 | 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) | |
| 75 | 64 | }, |
| 76 | 65 | ) |
| 77 | 66 | } |
| @@ -56,6 +56,10 @@ pub enum Subcommands { · 55 unmodified lines | ||
| 56 | 56 | /// Possible values are "none" and "tree-traversal". Default is "none". |
| 57 | 57 | expansion: Option<core::pack::create::ObjectExpansion>, |
| 58 | 58 | |
| 59 | + /// The directory into which to write the pack file. | |
| 60 | + #[clap(long, short = 'o')] | |
| 61 | + output_directory: PathBuf, | |
| 62 | + | |
| 59 | 63 | /// the tips from which to start the commit graph iteration. |
| 60 | 64 | /// |
| 61 | 65 | /// If empty, we expect to read objects on stdin and default to 'none' as expansion mode. |