Skip to content

Commit 9a476df

Browse files
committed
reduce verbosity of clone and print once entire clone is done (#450)
1 parent a0655dc commit 9a476df

File tree

2 files changed

+9
-32
lines changed

2 files changed

+9
-32
lines changed

Diff for: gitoxide-core/src/repository/clone.rs

+8-31
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,12 @@ pub(crate) mod function {
5555
let (mut checkout, fetch_outcome) =
5656
prepare.fetch_then_checkout(&mut progress, &git::interrupt::IS_INTERRUPTED)?;
5757

58+
let repo = if bare {
59+
checkout.persist()
60+
} else {
61+
checkout.main_worktree(progress, &git::interrupt::IS_INTERRUPTED)?
62+
};
63+
5864
if handshake_info {
5965
writeln!(out, "Handshake Information")?;
6066
writeln!(out, "\t{:?}", fetch_outcome.ref_map.handshake)?;
@@ -65,43 +71,14 @@ pub(crate) mod function {
6571
unreachable!("clone always has changes")
6672
}
6773
Status::DryRun { .. } => unreachable!("dry-run unsupported"),
68-
Status::Change {
69-
update_refs,
70-
write_pack_bundle,
71-
} => {
72-
let repo = checkout.repo();
74+
Status::Change { update_refs, .. } => {
7375
let remote = repo
7476
.find_default_remote(git::remote::Direction::Fetch)
7577
.expect("one origin remote")?;
7678
let ref_specs = remote.refspecs(git::remote::Direction::Fetch);
77-
print_updates(
78-
checkout.repo(),
79-
update_refs,
80-
ref_specs,
81-
fetch_outcome.ref_map,
82-
&mut out,
83-
err,
84-
)?;
85-
if let Some(data_path) = write_pack_bundle.data_path {
86-
writeln!(out, "pack file: \"{}\"", data_path.display()).ok();
87-
}
88-
if let Some(index_path) = write_pack_bundle.index_path {
89-
writeln!(out, "index file: \"{}\"", index_path.display()).ok();
90-
}
79+
print_updates(&repo, update_refs, ref_specs, fetch_outcome.ref_map, &mut out, err)?;
9180
}
9281
};
93-
94-
let repo = if bare {
95-
checkout.persist()
96-
} else {
97-
checkout.main_worktree(progress, &git::interrupt::IS_INTERRUPTED)?
98-
};
99-
writeln!(
100-
out,
101-
"clone (bare = {}) successful at \"{}\"",
102-
bare,
103-
repo.work_dir().unwrap_or_else(|| repo.git_dir()).display()
104-
)?;
10582
Ok(())
10683
}
10784
}

Diff for: src/plumbing/main.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ pub fn main() -> Result<()> {
129129
verbose,
130130
progress,
131131
progress_keep_open,
132-
core::repository::fetch::PROGRESS_RANGE,
132+
core::repository::clone::PROGRESS_RANGE,
133133
move |progress, out, err| core::repository::clone(remote, directory, progress, out, err, opts),
134134
)
135135
}

0 commit comments

Comments
 (0)