| @@ -73,14 +73,32 @@ where · 72 unmodified lines |
| 73 | 73 | P: gix_features::progress::NestedProgress, |
| 74 | 74 | P::SubProgress: 'static, |
| 75 | 75 | { |
| 76 | + let ref_map = &self.ref_map; |
| 77 | + if ref_map.mappings.is_empty() && !ref_map.remote_refs.is_empty() { |
| 78 | + let mut specs = ref_map.refspecs.clone(); |
| 79 | + specs.extend(ref_map.extra_refspecs.clone()); |
| 80 | + return Err(Error::NoMapping { |
| 81 | + refspecs: specs, |
| 82 | + num_remote_refs: ref_map.remote_refs.len(), |
| 83 | + }); |
| 84 | + } |
| 85 | + |
| 76 | 86 | let mut con = self.con.take().expect("receive() can only be called once"); |
| 77 | 87 | let mut handshake = con.handshake.take().expect("receive() can only be called once"); |
| 78 | 88 | let repo = con.remote.repo; |
| 89 | + |
| 90 | + let expected_object_hash = repo.object_hash(); |
| 91 | + if ref_map.object_hash != expected_object_hash { |
| 92 | + return Err(Error::IncompatibleObjectHash { |
| 93 | + local: expected_object_hash, |
| 94 | + remote: ref_map.object_hash, |
| 95 | + }); |
| 96 | + } |
| 97 | + |
| 79 | 98 | let fetch_options = gix_protocol::fetch::Options { |
| 80 | 99 | shallow_file: repo.shallow_file(), |
| 81 | 100 | shallow: &self.shallow, |
| 82 | 101 | tags: con.remote.fetch_tags, |
| 83 | | − expected_object_hash: repo.object_hash(), |
| 84 | 102 | reject_shallow_remote: repo |
| 85 | 103 | .config |
| 86 | 104 | .resolved |
| @@ -95,7 +113,7 @@ where · 8 unmodified lines |
| 95 | 113 | user_agent: repo.config.user_agent_tuple(), |
| 96 | 114 | trace_packetlines: con.trace, |
| 97 | 115 | }; |
| 98 | | − let ref_map = &self.ref_map; |
| 116 | + |
| 99 | 117 | let negotiator = repo |
| 100 | 118 | .config |
| 101 | 119 | .resolved |
| @@ -137,7 +155,6 @@ where · 35 unmodified lines |
| 137 | 155 | let mut write_pack_bundle = None; |
| 138 | 156 | |
| 139 | 157 | let res = gix_protocol::fetch( |
| 140 | | − ref_map, |
| 141 | 158 | &mut negotiate, |
| 142 | 159 | |reader, progress, should_interrupt| -> Result<bool, gix_pack::bundle::write::Error> { |
| 143 | 160 | let mut may_read_to_end = false; |