History

[clone] When unpacking peeled refs, use the object that refers to the tag…

…and not the one that refers to the (usually) commit the tags points to. When declaring wants, it really wants to see tips first, it appears. Quite tricky

Sebastian Thiel committed 6 years ago

Commit fe8bb391 parent 7c8ecb73 files · +6 −4Browse files

Showing the changes to git-protocol/src (1 of 3 files). Show all

Unified · Split

git-protocol/src/fetch/refs.rs+4−2
@@ -54,10 +54,12 @@ pub enum Ref { · 53 unmodified lines
54}54}
55 55
56impl Ref {56impl Ref {
57 pub fn unpack_common(&self) -> (&BString, &owned::Id) {57 /// Provide shared fields referring to the ref itself. In case of peeled refs, the tag object itself is returned as it is what
58 /// the path refers to.
59 pub fn unpack(&self) -> (&BString, &owned::Id) {
58 match self {60 match self {
59 Ref::Direct { path, object, .. }61 Ref::Direct { path, object, .. }
60 | Ref::Peeled { path, object, .. }62 | Ref::Peeled { path, tag: object, .. } // the tag acts as reference
61 | Ref::Symbolic { path, object, .. } => (path, object),63 | Ref::Symbolic { path, object, .. } => (path, object),
62 }64 }
63 }65 }