Allocation-free parent retrieval.
Showing the changes to git-object/tests/immutable/commit (1 of 3 files). Show all
Unified · Split
| @@ -112,6 +112,12 @@ fn signed_singleline() -> crate::Result { · 111 unmodified lines | ||
| 112 | 112 | Token::Message(b"update tasks\n".as_bstr()), |
| 113 | 113 | ] |
| 114 | 114 | ); |
| 115 | + assert_eq!( | |
| 116 | + CommitRefIter::from_bytes(&fixture_bytes("commit", "signed-singleline.txt")) | |
| 117 | + .parent_ids() | |
| 118 | + .collect::<Vec<_>>(), | |
| 119 | + vec![hex_to_id("09d8d3a12e161a7f6afb522dbe8900a9c09bce06")] | |
| 120 | + ); | |
| 115 | 121 | Ok(()) |
| 116 | 122 | } |
| 117 | 123 | |
| @@ -151,6 +157,15 @@ fn mergetag() -> crate::Result { · 33 unmodified lines | ||
| 151 | 157 | Token::Message(LONG_MESSAGE.as_bytes().as_bstr()), |
| 152 | 158 | ] |
| 153 | 159 | ); |
| 160 | + assert_eq!( | |
| 161 | + CommitRefIter::from_bytes(&fixture_bytes("commit", "mergetag.txt")) | |
| 162 | + .parent_ids() | |
| 163 | + .collect::<Vec<_>>(), | |
| 164 | + vec![ | |
| 165 | + hex_to_id("44ebe016df3aad96e3be8f95ec52397728dd7701"), | |
| 166 | + hex_to_id("8d485da0ddee79d0e6713405694253d401e41b93") | |
| 167 | + ] | |
| 168 | + ); | |
| 154 | 169 | Ok(()) |
| 155 | 170 | } |
| 156 | 171 | |
| @@ -174,6 +189,12 @@ mod method { · 17 unmodified lines | ||
| 174 | 189 | .collect::<Vec<_>>(), |
| 175 | 190 | vec![signature(1592437401), signature(1592437401)] |
| 176 | 191 | ); |
| 192 | + assert_eq!( | |
| 193 | + CommitRefIter::from_bytes(&fixture_bytes("commit", "unsigned.txt")) | |
| 194 | + .parent_ids() | |
| 195 | + .count(), | |
| 196 | + 0 | |
| 197 | + ); | |
| 177 | 198 | Ok(()) |
| 178 | 199 | } |
| 179 | 200 | |