Skip to content

Commit

Permalink
first basic printing of result when no change was found (#450)
Browse files Browse the repository at this point in the history
This just prints the ref-map, which will be determined to have no change
at all.
  • Loading branch information
Byron committed Oct 2, 2022
1 parent 981488b commit cd1d2aa
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
12 changes: 11 additions & 1 deletion gitoxide-core/src/repository/fetch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ pub(crate) mod function {
use crate::OutputFormat;
use anyhow::bail;
use git_repository as git;
use git_repository::remote::fetch::Status;

pub fn fetch(
repo: git::Repository,
Expand All @@ -43,6 +44,15 @@ pub(crate) mod function {
.with_dry_run(dry_run)
.receive(&git::interrupt::IS_INTERRUPTED)?;

Ok(())
match res.status {
Status::NoChange => crate::repository::remote::refs::print_refmap(
&repo,
remote.refspecs(git::remote::Direction::Fetch),
res.ref_map,
out,
err,
),
Status::Change { update_refs, .. } | Status::DryRun { update_refs } => todo!("change printing or dry-run"),
}
}
}
4 changes: 2 additions & 2 deletions gitoxide-core/src/repository/remote.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ mod refs_impl {
pub handshake_info: bool,
}

pub(crate) use super::print;
pub(crate) use super::{print, print_refmap};
}

#[git::protocol::maybe_async::maybe_async]
Expand Down Expand Up @@ -91,7 +91,7 @@ mod refs_impl {
}
}

fn print_refmap(
pub(crate) fn print_refmap(
repo: &git::Repository,
refspecs: &[RefSpec],
mut map: git::remote::fetch::RefMap<'_>,
Expand Down

0 comments on commit cd1d2aa

Please sign in to comment.