diff options
| author | DanConwayDev <DanConwayDev@protonmail.com> | 2025-10-10 17:25:49 +0100 |
|---|---|---|
| committer | DanConwayDev <DanConwayDev@protonmail.com> | 2025-10-10 17:25:49 +0100 |
| commit | 0e8fcc743b343c620a6723f5ad517ab98f140401 (patch) | |
| tree | ce1e07da4280008429a0ff1fe74b2cc79e898ac1 /src/bin/ngit/sub_commands/send.rs | |
| parent | 5fd28d490b2b5627f2bdb8e1318c70de4469eb13 (diff) | |
feat(send): add `force-pr` or `force-patch` flags
so users can choose when there commits are too big or small instead
of relying on the 60kb rule
Diffstat (limited to 'src/bin/ngit/sub_commands/send.rs')
| -rw-r--r-- | src/bin/ngit/sub_commands/send.rs | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/src/bin/ngit/sub_commands/send.rs b/src/bin/ngit/sub_commands/send.rs index ba64f64..0e4a572 100644 --- a/src/bin/ngit/sub_commands/send.rs +++ b/src/bin/ngit/sub_commands/send.rs | |||
| @@ -43,6 +43,12 @@ pub struct SubCommandArgs { | |||
| 43 | #[clap(short, long)] | 43 | #[clap(short, long)] |
| 44 | /// optional cover letter description | 44 | /// optional cover letter description |
| 45 | pub(crate) description: Option<String>, | 45 | pub(crate) description: Option<String>, |
| 46 | /// publish as Pull Request even if each commit is < 60kb | ||
| 47 | #[arg(long, action)] | ||
| 48 | pub(crate) force_pr: bool, | ||
| 49 | /// publish as Patches even if they may be > 60kb | ||
| 50 | #[arg(long, action)] | ||
| 51 | pub(crate) force_patch: bool, | ||
| 46 | } | 52 | } |
| 47 | 53 | ||
| 48 | #[allow(clippy::too_many_lines)] | 54 | #[allow(clippy::too_many_lines)] |
| @@ -116,7 +122,7 @@ pub async fn launch(cli_args: &Cli, args: &SubCommandArgs, no_fetch: bool) -> Re | |||
| 116 | &main_tip, | 122 | &main_tip, |
| 117 | )?; | 123 | )?; |
| 118 | 124 | ||
| 119 | let as_pr = { | 125 | let should_be_pr = { |
| 120 | if let Some(root_proposal) = &root_proposal { | 126 | if let Some(root_proposal) = &root_proposal { |
| 121 | proposal_tip_is_pr_or_pr_update(git_repo_path, &repo_ref, &root_proposal.id).await? | 127 | proposal_tip_is_pr_or_pr_update(git_repo_path, &repo_ref, &root_proposal.id).await? |
| 122 | } else { | 128 | } else { |
| @@ -124,6 +130,14 @@ pub async fn launch(cli_args: &Cli, args: &SubCommandArgs, no_fetch: bool) -> Re | |||
| 124 | } | 130 | } |
| 125 | } || git_repo.are_commits_too_big_for_patches(&commits); | 131 | } || git_repo.are_commits_too_big_for_patches(&commits); |
| 126 | 132 | ||
| 133 | let as_pr = if args.force_patch { | ||
| 134 | false | ||
| 135 | } else if args.force_pr { | ||
| 136 | true | ||
| 137 | } else { | ||
| 138 | should_be_pr | ||
| 139 | }; | ||
| 140 | |||
| 127 | let title = if as_pr { | 141 | let title = if as_pr { |
| 128 | match &args.title { | 142 | match &args.title { |
| 129 | Some(t) => Some(t.clone()), | 143 | Some(t) => Some(t.clone()), |