upleb.uk

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

summaryrefslogtreecommitdiff
path: root/src/lib/git/identify_ahead_behind.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/lib/git/identify_ahead_behind.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/lib/git/identify_ahead_behind.rs')
-rw-r--r--src/lib/git/identify_ahead_behind.rs8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/lib/git/identify_ahead_behind.rs b/src/lib/git/identify_ahead_behind.rs
index c98c994..d736522 100644
--- a/src/lib/git/identify_ahead_behind.rs
+++ b/src/lib/git/identify_ahead_behind.rs
@@ -16,7 +16,7 @@ pub fn identify_ahead_behind(
16 name.to_string(), 16 name.to_string(),
17 git_repo 17 git_repo
18 .get_tip_of_branch(name) 18 .get_tip_of_branch(name)
19 .context(format!("cannot find from_branch '{name}'"))?, 19 .context(format!("failed to find from_branch '{name}'"))?,
20 ), 20 ),
21 None => ( 21 None => (
22 if let Ok(name) = git_repo.get_checked_out_branch_name() { 22 if let Ok(name) = git_repo.get_checked_out_branch_name() {
@@ -38,7 +38,7 @@ pub fn identify_ahead_behind(
38 name.to_string(), 38 name.to_string(),
39 git_repo 39 git_repo
40 .get_tip_of_branch(name) 40 .get_tip_of_branch(name)
41 .context(format!("cannot find to_branch '{name}'"))?, 41 .context(format!("failed to find to_branch '{name}'"))?,
42 ), 42 ),
43 None => { 43 None => {
44 let (name, commit) = git_repo 44 let (name, commit) = git_repo
@@ -82,7 +82,7 @@ mod tests {
82 identify_ahead_behind(&git_repo, &Some(branch_name.to_string()), &None) 82 identify_ahead_behind(&git_repo, &Some(branch_name.to_string()), &None)
83 .unwrap_err() 83 .unwrap_err()
84 .to_string(), 84 .to_string(),
85 format!("cannot find from_branch '{}'", &branch_name), 85 format!("failed to find from_branch '{}'", &branch_name),
86 ); 86 );
87 Ok(()) 87 Ok(())
88 } 88 }
@@ -98,7 +98,7 @@ mod tests {
98 identify_ahead_behind(&git_repo, &None, &Some(branch_name.to_string())) 98 identify_ahead_behind(&git_repo, &None, &Some(branch_name.to_string()))
99 .unwrap_err() 99 .unwrap_err()
100 .to_string(), 100 .to_string(),
101 format!("cannot find to_branch '{}'", &branch_name), 101 format!("failed to find to_branch '{}'", &branch_name),
102 ); 102 );
103 Ok(()) 103 Ok(())
104 } 104 }