upleb.uk

Public git repos — served from a NIP-34 GRASP relay at git.upleb.uk

summaryrefslogtreecommitdiff
path: root/src/bin/ngit/sub_commands/push.rs
diff options
context:
space:
mode:
authorDanConwayDev <DanConwayDev@protonmail.com>2024-11-26 07:48:30 +0000
committerDanConwayDev <DanConwayDev@protonmail.com>2024-11-26 12:26:47 +0000
commita0593e3aa9b19b9ca3c3881cbe0d9d207fe46d2c (patch)
tree3482e7c558eff09cc91604ad6ddcd02cf2c94699 /src/bin/ngit/sub_commands/push.rs
parent1332c625b75fce616e06b415c99a068bc45c8210 (diff)
refactor: err msgs 'cannot' > 'failed to'
in nearly all cases 'cannot' was used when an action was tried and failed. 'failed to' is strictly better because: * just because the action didn't work that time doesnt mean it cannot work * it is better at drawing the users attention to a problem
Diffstat (limited to 'src/bin/ngit/sub_commands/push.rs')
-rw-r--r--src/bin/ngit/sub_commands/push.rs10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/bin/ngit/sub_commands/push.rs b/src/bin/ngit/sub_commands/push.rs
index aaf1009..89b2364 100644
--- a/src/bin/ngit/sub_commands/push.rs
+++ b/src/bin/ngit/sub_commands/push.rs
@@ -29,7 +29,7 @@ pub struct SubCommandArgs {
29 29
30#[allow(clippy::too_many_lines)] 30#[allow(clippy::too_many_lines)]
31pub async fn launch(cli_args: &Cli, args: &SubCommandArgs) -> Result<()> { 31pub async fn launch(cli_args: &Cli, args: &SubCommandArgs) -> Result<()> {
32 let git_repo = Repo::discover().context("cannot find a git repository")?; 32 let git_repo = Repo::discover().context("failed to find a git repository")?;
33 let git_repo_path = git_repo.get_path()?; 33 let git_repo_path = git_repo.get_path()?;
34 34
35 let (main_or_master_branch_name, _) = git_repo 35 let (main_or_master_branch_name, _) = git_repo
@@ -42,7 +42,7 @@ pub async fn launch(cli_args: &Cli, args: &SubCommandArgs) -> Result<()> {
42 42
43 let branch_name = git_repo 43 let branch_name = git_repo
44 .get_checked_out_branch_name() 44 .get_checked_out_branch_name()
45 .context("cannot get checked out branch name")?; 45 .context("failed to get checked out branch name")?;
46 46
47 if branch_name == main_or_master_branch_name { 47 if branch_name == main_or_master_branch_name {
48 bail!("checkout a branch associated with a proposal first") 48 bail!("checkout a branch associated with a proposal first")
@@ -70,7 +70,7 @@ pub async fn launch(cli_args: &Cli, args: &SubCommandArgs) -> Result<()> {
70 is_event_proposal_root_for_branch(e, &branch_name, &logged_in_public_key) 70 is_event_proposal_root_for_branch(e, &branch_name, &logged_in_public_key)
71 .unwrap_or(false) 71 .unwrap_or(false)
72 }) 72 })
73 .context("cannot find proposal that matches the current branch name")? 73 .context("failed to find proposal that matches the current branch name")?
74 .clone(); 74 .clone();
75 75
76 let commit_events = 76 let commit_events =
@@ -78,7 +78,7 @@ pub async fn launch(cli_args: &Cli, args: &SubCommandArgs) -> Result<()> {
78 .await?; 78 .await?;
79 79
80 let most_recent_proposal_patch_chain = get_most_recent_patch_with_ancestors(commit_events) 80 let most_recent_proposal_patch_chain = get_most_recent_patch_with_ancestors(commit_events)
81 .context("cannot get most recent patch for proposal")?; 81 .context("failed to get most recent patch for proposal")?;
82 82
83 let branch_tip = git_repo.get_tip_of_branch(&branch_name)?; 83 let branch_tip = git_repo.get_tip_of_branch(&branch_name)?;
84 84
@@ -191,7 +191,7 @@ pub async fn launch(cli_args: &Cli, args: &SubCommandArgs) -> Result<()> {
191 &[], 191 &[],
192 ) 192 )
193 .await 193 .await
194 .context("cannot make patch event from commit")?, 194 .context("failed to make patch event from commit")?,
195 ); 195 );
196 } 196 }
197 println!("pushing {} commits", ahead.len()); 197 println!("pushing {} commits", ahead.len());