Unified · Split
| @@ -83,37 +83,32 @@ pub fn checkout_exclusive( · 82 unmodified lines | |||
| 83 | files_updated, | 83 | files_updated, |
| 84 | bytes_written, | 84 | bytes_written, |
| 85 | } = match repo { | 85 | } = match repo { |
| 86 | Some(repo) => { | 86 | Some(repo) => git::worktree::index::checkout( |
| 87 | let git_dir = repo.git_dir().to_owned(); | 87 | &mut index, |
| 88 | git::worktree::index::checkout( | 88 | dest_directory, |
| 89 | &mut index, | 89 | { |
| 90 | dest_directory, | 90 | let objects = repo.objects.into_arc()?; |
| 91 | git_dir, | 91 | move |oid, buf| { |
| 92 | { | 92 | objects.find_blob(oid, buf).ok(); |
| 93 | let objects = repo.objects.into_arc()?; | 93 | if empty_files { |
| 94 | move |oid, buf| { | 94 | // We always want to query the ODB here… |
| 95 | objects.find_blob(oid, buf).ok(); | 95 | objects.find_blob(oid, buf)?; |
| 96 | if empty_files { | 96 | buf.clear(); |
| 97 | // We always want to query the ODB here… | 97 | // …but write nothing |
| 98 | objects.find_blob(oid, buf)?; | 98 | Ok(git::objs::BlobRef { data: buf }) |
| 99 | buf.clear(); | 99 | } else { |
| 100 | // …but write nothing | 100 | objects.find_blob(oid, buf) |
| 101 | Ok(git::objs::BlobRef { data: buf }) | ||
| 102 | } else { | ||
| 103 | objects.find_blob(oid, buf) | ||
| 104 | } | ||
| 105 | } | 101 | } |
| 106 | }, | 102 | } |
| 107 | &mut files, | 103 | }, |
| 108 | &mut bytes, | 104 | &mut files, |
| 109 | should_interrupt, | 105 | &mut bytes, |
| 110 | opts, | 106 | should_interrupt, |
| 111 | ) | 107 | opts, |
| 112 | } | 108 | ), |
| 113 | None => git::worktree::index::checkout( | 109 | None => git::worktree::index::checkout( |
| 114 | &mut index, | 110 | &mut index, |
| 115 | dest_directory, | 111 | dest_directory, |
| 116 | dest_directory, | ||
| 117 | |_, buf| { | 112 | |_, buf| { |
| 118 | buf.clear(); | 113 | buf.clear(); |
| 119 | Ok(git::objs::BlobRef { data: buf }) | 114 | Ok(git::objs::BlobRef { data: buf }) |