Showing the changes to gitoxide-core/src (1 of 4 files). Show all
Unified · Split
| @@ -68,24 +68,29 @@ pub fn checkout_exclusive( · 67 unmodified lines | ||
| 68 | 68 | bytes.init(None, git::progress::bytes()); |
| 69 | 69 | |
| 70 | 70 | let start = std::time::Instant::now(); |
| 71 | + let no_repo = repo.is_none(); | |
| 71 | 72 | let checkout::Outcome { |
| 72 | 73 | errors, |
| 73 | 74 | collisions, |
| 74 | 75 | files_updated, |
| 75 | − } = match &repo { | |
| 76 | + bytes_written, | |
| 77 | + } = match repo { | |
| 76 | 78 | Some(repo) => git::worktree::index::checkout( |
| 77 | 79 | &mut index, |
| 78 | 80 | dest_directory, |
| 79 | − |oid, buf| { | |
| 80 | − repo.objects.find_blob(oid, buf).ok(); | |
| 81 | − if empty_files { | |
| 82 | − // We always want to query the ODB here… | |
| 83 | − repo.objects.find_blob(oid, buf)?; | |
| 84 | − buf.clear(); | |
| 85 | − // …but write nothing | |
| 86 | − Ok(git::objs::BlobRef { data: buf }) | |
| 87 | − } else { | |
| 88 | − repo.objects.find_blob(oid, buf) | |
| 81 | + { | |
| 82 | + let objects = repo.objects.into_arc()?; | |
| 83 | + move |oid, buf| { | |
| 84 | + objects.find_blob(oid, buf).ok(); | |
| 85 | + if empty_files { | |
| 86 | + // We always want to query the ODB here… | |
| 87 | + objects.find_blob(oid, buf)?; | |
| 88 | + buf.clear(); | |
| 89 | + // …but write nothing | |
| 90 | + Ok(git::objs::BlobRef { data: buf }) | |
| 91 | + } else { | |
| 92 | + objects.find_blob(oid, buf) | |
| 93 | + } | |
| 89 | 94 | } |
| 90 | 95 | }, |
| 91 | 96 | &mut files, |
| @@ -111,9 +116,9 @@ pub fn checkout_exclusive( · 19 unmodified lines | ||
| 111 | 116 | bytes.show_throughput(start); |
| 112 | 117 | |
| 113 | 118 | progress.done(format!( |
| 114 | − "Created {} {} files{}", | |
| 119 | + "Created {} {} files{} ({})", | |
| 115 | 120 | files_updated, |
| 116 | − repo.is_none().then(|| "empty").unwrap_or_default(), | |
| 121 | + no_repo.then(|| "empty").unwrap_or_default(), | |
| 117 | 122 | should_interrupt |
| 118 | 123 | .load(Ordering::Relaxed) |
| 119 | 124 | .then(|| { |
| @@ -123,6 +128,9 @@ pub fn checkout_exclusive( · 3 unmodified lines | ||
| 123 | 128 | ) |
| 124 | 129 | }) |
| 125 | 130 | .unwrap_or_default(), |
| 131 | + git_features::progress::bytes() | |
| 132 | + .unwrap() | |
| 133 | + .display(bytes_written as usize, None, None) | |
| 126 | 134 | )); |
| 127 | 135 | |
| 128 | 136 | if !(collisions.is_empty() && errors.is_empty()) { |