diff --git a/lib/src/git.rs b/lib/src/git.rs index d7995c4da2..f188f7f001 100644 --- a/lib/src/git.rs +++ b/lib/src/git.rs @@ -1466,8 +1466,8 @@ impl<'a> GitFetch<'a> { GitFetchError::PathConversionError(self.git_repo.path().to_path_buf()) })?; - // TODO: there is surely a better way to get this? it seems like it's stored in the - // workspace, but that seems inaccessible here + // TODO: there is surely a better way to get this? it seems like it's stored in + // the workspace, but that seems inaccessible here let work_tree = work_tree_from_git_dir(self.git_repo.path()) .map(|p| { p.to_str() @@ -1737,20 +1737,20 @@ fn check_allow_push( Ok(PushAllowReason::NormalMatch) => {} Ok(PushAllowReason::UnexpectedNoop) => { tracing::info!( - "The push of {dst_refname} is unexpectedly a no-op, the remote branch \ - is already at {actual_remote_location:?}. We expected it to be at \ - {expected_remote_location:?}. We don't consider this an error.", + "The push of {dst_refname} is unexpectedly a no-op, the remote branch is already \ + at {actual_remote_location:?}. We expected it to be at \ + {expected_remote_location:?}. We don't consider this an error.", ); } Ok(PushAllowReason::ExceptionalFastforward) => { // TODO(ilyagr): We could consider printing a user-facing message at // this point. tracing::info!( - "We allow the push of {dst_refname} to {local_location:?}, even \ - though it is unexpectedly at {actual_remote_location:?} on the \ - server rather than the expected {expected_remote_location:?}. The \ - desired location is a descendant of the actual location, and the \ - actual location is a descendant of the expected location.", + "We allow the push of {dst_refname} to {local_location:?}, even though it is \ + unexpectedly at {actual_remote_location:?} on the server rather than the \ + expected {expected_remote_location:?}. The desired location is a descendant of \ + the actual location, and the actual location is a descendant of the expected \ + location.", ); } Err(()) => { @@ -1760,9 +1760,9 @@ fn check_allow_push( // fetch`, and the resulting branch conflicts should contain // all the information they need. tracing::info!( - "Cannot push {dst_refname} to {local_location:?}; it is at \ - unexpectedly at {actual_remote_location:?} on the server as opposed \ - to the expected {expected_remote_location:?}", + "Cannot push {dst_refname} to {local_location:?}; it is at unexpectedly at \ + {actual_remote_location:?} on the server as opposed to the expected \ + {expected_remote_location:?}", ); failed_ref_matches.push(dst_refname.to_string()); return false; @@ -2225,7 +2225,8 @@ fn convert_git_fetch_output_to_fetch_result( // GitFetchError::NoSuchRemote // - // To say this, git prints out a lot of things, but the first line is of the form: + // To say this, git prints out a lot of things, but the first line is of the + // form: // `fatal: '' does not appear to be a git repository` let git_err = { let mut git_err = None; @@ -2248,8 +2249,8 @@ fn convert_git_fetch_output_to_fetch_result( return e; } - // even though --prune is specified, if a particular refspec is asked for but not present - // in the remote, git will error out. + // even though --prune is specified, if a particular refspec is asked for but + // not present in the remote, git will error out. // we ignore it explicitely // // The first line is of the form: @@ -2336,7 +2337,8 @@ fn convert_git_remote_show_output_to_fetch_result( // GitFetchError::NoSuchRemote // - // To say this, git prints out a lot of things, but the first line is of the form: + // To say this, git prints out a lot of things, but the first line is of the + // form: // `fatal: '' does not appear to be a git repository` let git_err = { let mut git_err = None; @@ -2359,8 +2361,8 @@ fn convert_git_remote_show_output_to_fetch_result( return e; } - // even though --prune is specified, if a particular refspec is asked for but not present - // in the remote, git will error out. + // even though --prune is specified, if a particular refspec is asked for but + // not present in the remote, git will error out. // we ignore it explicitely // // The first line is of the form: @@ -2390,7 +2392,10 @@ fn fork_git_remote_show( work_tree: &str, remote_name: &str, ) -> Result, GitFetchError> { - tracing::debug!("shelling out to `git --git-dir={git_dir} --work-tree={work_tree} remote show {remote_name}`"); + tracing::debug!( + "shelling out to `git --git-dir={git_dir} --work-tree={work_tree} remote show \ + {remote_name}`" + ); let remote_git = Command::new("git") .arg(format!("--git-dir={git_dir}")) @@ -2416,7 +2421,8 @@ fn fork_git_remote_show( .find(|x| x.starts_with("HEAD branch:")) .and_then(|x| x.split(" ").last().map(|y| y.trim().to_string())); - // git will ouptut (unknown) if there is no default branch. we want it to be a none value + // git will ouptut (unknown) if there is no default branch. we want it to be a + // none value if let Some(x) = branch_name.as_deref() { if x == "(unknown)" { return Ok(None); @@ -2448,7 +2454,7 @@ fn convert_git_branch_prune_output_to_fetch_result( // so, we want to ignore these particular errors with git // // The first line is of the form: - // error: remote-tracking branch '' not found + // `error: remote-tracking branch '' not found` if let Some(first_line) = stderr.lines().next() { if first_line.starts_with("error: remote-tracking branch '") && first_line.ends_with("' not found") @@ -2468,7 +2474,10 @@ fn fork_git_branch_prune( remote_name: &str, branch_name: &str, ) -> Result<(), GitFetchError> { - tracing::debug!("shelling out to `git --git-dir={git_dir} --work-tree={work_tree} branch --remotes --delete {remote_name}/{branch_name}`"); + tracing::debug!( + "shelling out to `git --git-dir={git_dir} --work-tree={work_tree} branch --remotes \ + --delete {remote_name}/{branch_name}`" + ); let branch_git = Command::new("git") .arg(format!("--git-dir={git_dir}")) .arg(format!("--work-tree={work_tree}")) @@ -2504,7 +2513,8 @@ fn convert_git_push_output_to_push_result(output: Output) -> Result' does not appear to be a git repository` let git_err = { let mut git_err = None; @@ -2529,8 +2539,9 @@ fn convert_git_push_output_to_push_result(output: Output) -> Result' does not appear to be a git repository` + // If the remote repo is specified with the URL directly it gives a slightly + // different error `fatal: '' does not appear to be a git + // repository` let git_err = { let mut git_err = None; if let Some(first_line) = stderr.lines().next() { @@ -2604,7 +2615,8 @@ fn convert_git_ls_remote_to_push_result(output: Output) -> Result' does not appear to be a git repository` let git_err = { let mut git_err = None; @@ -2629,8 +2641,9 @@ fn convert_git_ls_remote_to_push_result(output: Output) -> Result' does not appear to be a git repository` + // If the remote repo is specified with the URL directly it gives a slightly + // different error `fatal: '' does not appear to be a git + // repository` let git_err = { let mut git_err = None; if let Some(first_line) = stderr.lines().next() {