Skip to content

Commit

Permalink
fix fmt errors
Browse files Browse the repository at this point in the history
  • Loading branch information
bsdinis committed Jan 2, 2025
1 parent 2a1d29b commit 429d536
Showing 1 changed file with 42 additions and 29 deletions.
71 changes: 42 additions & 29 deletions lib/src/git.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down Expand Up @@ -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(()) => {
Expand All @@ -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;
Expand Down Expand Up @@ -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: '<branch_name>' does not appear to be a git repository`
let git_err = {
let mut git_err = None;
Expand All @@ -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

Check failure on line 2254 in lib/src/git.rs

View workflow job for this annotation

GitHub Actions / Codespell

explicitely ==> explicitly
//
// The first line is of the form:
Expand Down Expand Up @@ -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: '<branch_name>' does not appear to be a git repository`
let git_err = {
let mut git_err = None;
Expand All @@ -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

Check failure on line 2366 in lib/src/git.rs

View workflow job for this annotation

GitHub Actions / Codespell

explicitely ==> explicitly
//
// The first line is of the form:
Expand Down Expand Up @@ -2390,7 +2392,10 @@ fn fork_git_remote_show(
work_tree: &str,
remote_name: &str,
) -> Result<Option<String>, 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}"))
Expand All @@ -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

Check failure on line 2424 in lib/src/git.rs

View workflow job for this annotation

GitHub Actions / Codespell

ouptut ==> output
// none value
if let Some(x) = branch_name.as_deref() {
if x == "(unknown)" {
return Ok(None);
Expand Down Expand Up @@ -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 '<branch>' not found
// `error: remote-tracking branch '<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")
Expand All @@ -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}"))
Expand Down Expand Up @@ -2504,7 +2513,8 @@ fn convert_git_push_output_to_push_result(output: Output) -> Result<Output, GitP

// GitPushError::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: '<branch_name>' does not appear to be a git repository`
let git_err = {
let mut git_err = None;
Expand All @@ -2529,8 +2539,9 @@ fn convert_git_push_output_to_push_result(output: Output) -> Result<Output, GitP

// GitPushError::NoSuchRemote
//
// If the remote repo is specified with the URL directly it gives a slightly different error
// `fatal: '<branch_name>' 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: '<branch_name>' does not appear to be a git
// repository`
let git_err = {
let mut git_err = None;
if let Some(first_line) = stderr.lines().next() {
Expand Down Expand Up @@ -2604,7 +2615,8 @@ fn convert_git_ls_remote_to_push_result(output: Output) -> Result<Output, GitPus

// GitPushError::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: '<branch_name>' does not appear to be a git repository`
let git_err = {
let mut git_err = None;
Expand All @@ -2629,8 +2641,9 @@ fn convert_git_ls_remote_to_push_result(output: Output) -> Result<Output, GitPus

// GitPushError::NoSuchRemote
//
// If the remote repo is specified with the URL directly it gives a slightly different error
// `fatal: '<branch_name>' 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: '<branch_name>' does not appear to be a git
// repository`
let git_err = {
let mut git_err = None;
if let Some(first_line) = stderr.lines().next() {
Expand Down

0 comments on commit 429d536

Please sign in to comment.