| @@ -159,34 +159,37 @@ mod changes { · 158 unmodified lines |
| 159 | fn many_different_states() -> crate::Result { | 159 | fn many_different_states() -> crate::Result { |
| 160 | let db = db(None)?; | 160 | let db = db(None)?; |
| 161 | let all_commits = all_commits(&db); | 161 | let all_commits = all_commits(&db); |
| 162 | assert_hash_agnostic_eq!( | 162 | pretty_assertions::assert_eq!( |
| 163 | diff_with_previous_commit_from(&db, &all_commits["f added"])?, | 163 | diff_with_previous_commit_from(&db, &all_commits["f added"])?, |
| 164 | vec![Addition { | 164 | vec![Addition { |
| 165 | entry_mode: EntryKind::Blob.into(), | 165 | entry_mode: EntryKind::Blob.into(), |
| 166 | oid: hex_to_id("e69de29bb2d1d6434b8b29ae775ad8c2e48c5391"), | 166 | oid: hex_to_id("e69de29bb2d1d6434b8b29ae775ad8c2e48c5391", "473a0f4c3be8a93681a267e3b1e9a7dcda1185436fe141f7749120a303721813"), |
| 167 | path: "f".into(), | 167 | path: "f".into(), |
| 168 | relation: None | 168 | relation: None |
| 169 | }], | 169 | }], |
| 170 | ":000000 100644 0000000000000000000000000000000000000000 e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 A f" | 170 | ":000000 100644 0000000000000000000000000000000000000000 e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 A f" |
| 171 | ); | 171 | ); |
| 172 | | 172 | |
| 173 | assert_hash_agnostic_eq!( | 173 | pretty_assertions::assert_eq!( |
| 174 | diff_with_previous_commit_from(&db, &all_commits["f modified"])?, | 174 | diff_with_previous_commit_from(&db, &all_commits["f modified"])?, |
| 175 | vec![Modification { | 175 | vec![Modification { |
| 176 | previous_entry_mode: EntryKind::Blob.into(), | 176 | previous_entry_mode: EntryKind::Blob.into(), |
| 177 | previous_oid: hex_to_id("e69de29bb2d1d6434b8b29ae775ad8c2e48c5391"), | 177 | previous_oid: hex_to_id("e69de29bb2d1d6434b8b29ae775ad8c2e48c5391", "473a0f4c3be8a93681a267e3b1e9a7dcda1185436fe141f7749120a303721813"), |
| 178 | entry_mode: EntryKind::Blob.into(), | 178 | entry_mode: EntryKind::Blob.into(), |
| 179 | oid: hex_to_id("28ce6a8b26aa170e1de65536fe8abe1832bd3242"), | 179 | oid: hex_to_id("28ce6a8b26aa170e1de65536fe8abe1832bd3242", "6ca8d4e3bc5df874055e542d18505b5a5efa0fb7d65776efedc13781073ed0f1"), |
| 180 | path: "f".into() | 180 | path: "f".into() |
| 181 | }], | 181 | }], |
| 182 | ":100644 100644 e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 28ce6a8b26aa170e1de65536fe8abe1832bd3242 M f" | 182 | ":100644 100644 e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 28ce6a8b26aa170e1de65536fe8abe1832bd3242 M f" |
| 183 | ); | 183 | ); |
| 184 | | 184 | |
| 185 | assert_hash_agnostic_eq!( | 185 | pretty_assertions::assert_eq!( |
| 186 | diff_with_previous_commit_from(&db, &all_commits["f deleted"])?, | 186 | diff_with_previous_commit_from(&db, &all_commits["f deleted"])?, |
| 187 | vec![Deletion { | 187 | vec![Deletion { |
| 188 | entry_mode: EntryKind::Blob.into(), | 188 | entry_mode: EntryKind::Blob.into(), |
| 189 | oid: hex_to_id("28ce6a8b26aa170e1de65536fe8abe1832bd3242"), | 189 | oid: hex_to_id( |
| | 190 | "28ce6a8b26aa170e1de65536fe8abe1832bd3242", |
| | 191 | "6ca8d4e3bc5df874055e542d18505b5a5efa0fb7d65776efedc13781073ed0f1" |
| | 192 | ), |
| 190 | path: "f".into(), | 193 | path: "f".into(), |
| 191 | relation: None | 194 | relation: None |
| 192 | }], | 195 | }], |
| @@ -194,24 +197,24 @@ mod changes { · 1 unmodified line |
| 194 | " | 197 | " |
| 195 | ); | 198 | ); |
| 196 | | 199 | |
| 197 | assert_hash_agnostic_eq!( | 200 | pretty_assertions::assert_eq!( |
| 198 | diff_with_previous_commit_from(&db, &all_commits["f mode modified to dir f/"])?, | 201 | diff_with_previous_commit_from(&db, &all_commits["f mode modified to dir f/"])?, |
| 199 | vec![ | 202 | vec![ |
| 200 | Deletion { | 203 | Deletion { |
| 201 | entry_mode: EntryKind::Blob.into(), | 204 | entry_mode: EntryKind::Blob.into(), |
| 202 | oid: hex_to_id("28ce6a8b26aa170e1de65536fe8abe1832bd3242"), | 205 | oid: hex_to_id("28ce6a8b26aa170e1de65536fe8abe1832bd3242", "6ca8d4e3bc5df874055e542d18505b5a5efa0fb7d65776efedc13781073ed0f1"), |
| 203 | path: "f".into(), | 206 | path: "f".into(), |
| 204 | relation: None | 207 | relation: None |
| 205 | }, | 208 | }, |
| 206 | Addition { | 209 | Addition { |
| 207 | entry_mode: EntryKind::Tree.into(), | 210 | entry_mode: EntryKind::Tree.into(), |
| 208 | oid: hex_to_id("10f2f4b82222d2b5c31985130979a91fd87410f7"), | 211 | oid: hex_to_id("10f2f4b82222d2b5c31985130979a91fd87410f7", "9e220e584599b9cff376b638fa71675280f4582a87138b6be425258dbb85f94c"), |
| 209 | path: "f".into(), | 212 | path: "f".into(), |
| 210 | relation: Some(Relation::Parent(1)), | 213 | relation: Some(Relation::Parent(1)), |
| 211 | }, | 214 | }, |
| 212 | Addition { | 215 | Addition { |
| 213 | entry_mode: EntryKind::Blob.into(), | 216 | entry_mode: EntryKind::Blob.into(), |
| 214 | oid: hex_to_id("28ce6a8b26aa170e1de65536fe8abe1832bd3242"), | 217 | oid: hex_to_id("28ce6a8b26aa170e1de65536fe8abe1832bd3242", "6ca8d4e3bc5df874055e542d18505b5a5efa0fb7d65776efedc13781073ed0f1"), |
| 215 | path: "f/f".into(), | 218 | path: "f/f".into(), |
| 216 | relation: Some(Relation::ChildOfParent(1)), | 219 | relation: Some(Relation::ChildOfParent(1)), |
| 217 | } | 220 | } |
| @@ -220,18 +223,18 @@ mod changes { · 2 unmodified lines |
| 220 | :000000 100644 0000000000000000000000000000000000000000 28ce6a8b26aa170e1de65536fe8abe1832bd3242 A f/f" | 223 | :000000 100644 0000000000000000000000000000000000000000 28ce6a8b26aa170e1de65536fe8abe1832bd3242 A f/f" |
| 221 | ); | 224 | ); |
| 222 | | 225 | |
| 223 | assert_hash_agnostic_eq!( | 226 | pretty_assertions::assert_eq!( |
| 224 | diff_with_previous_commit_from(&db, &all_commits["a renamed to b"])?, | 227 | diff_with_previous_commit_from(&db, &all_commits["a renamed to b"])?, |
| 225 | vec![ | 228 | vec![ |
| 226 | Deletion { | 229 | Deletion { |
| 227 | entry_mode: EntryKind::Blob.into(), | 230 | entry_mode: EntryKind::Blob.into(), |
| 228 | oid: hex_to_id("e69de29bb2d1d6434b8b29ae775ad8c2e48c5391"), | 231 | oid: hex_to_id("e69de29bb2d1d6434b8b29ae775ad8c2e48c5391", "473a0f4c3be8a93681a267e3b1e9a7dcda1185436fe141f7749120a303721813"), |
| 229 | path: "a".into(), | 232 | path: "a".into(), |
| 230 | relation: None | 233 | relation: None |
| 231 | }, | 234 | }, |
| 232 | Addition { | 235 | Addition { |
| 233 | entry_mode: EntryKind::Blob.into(), | 236 | entry_mode: EntryKind::Blob.into(), |
| 234 | oid: hex_to_id("e69de29bb2d1d6434b8b29ae775ad8c2e48c5391"), | 237 | oid: hex_to_id("e69de29bb2d1d6434b8b29ae775ad8c2e48c5391", "473a0f4c3be8a93681a267e3b1e9a7dcda1185436fe141f7749120a303721813"), |
| 235 | path: "b".into(), | 238 | path: "b".into(), |
| 236 | relation: None | 239 | relation: None |
| 237 | } | 240 | } |
| @@ -242,43 +245,49 @@ mod changes { · 4 unmodified lines |
| 242 | | 245 | |
| 243 | ); | 246 | ); |
| 244 | | 247 | |
| 245 | assert_hash_agnostic_eq!( | 248 | pretty_assertions::assert_eq!( |
| 246 | diff_with_previous_commit_from(&db, &all_commits["f/f modified"])?, | 249 | diff_with_previous_commit_from(&db, &all_commits["f/f modified"])?, |
| 247 | vec![ | 250 | vec![ |
| 248 | Modification { | 251 | Modification { |
| 249 | previous_entry_mode: EntryKind::Tree.into(), | 252 | previous_entry_mode: EntryKind::Tree.into(), |
| 250 | previous_oid: hex_to_id("10f2f4b82222d2b5c31985130979a91fd87410f7"), | 253 | previous_oid: hex_to_id("10f2f4b82222d2b5c31985130979a91fd87410f7", "9e220e584599b9cff376b638fa71675280f4582a87138b6be425258dbb85f94c"), |
| 251 | entry_mode: EntryKind::Tree.into(), | 254 | entry_mode: EntryKind::Tree.into(), |
| 252 | oid: hex_to_id("ebbe0b3000afdfd1aed15000094b59a2800328eb"), | 255 | oid: hex_to_id("ebbe0b3000afdfd1aed15000094b59a2800328eb", "ca3ee6fe1455fc077ae53f0fe7af54153feb35d52a892b1377e9c0b6828428d4"), |
| 253 | path: "f".into() | 256 | path: "f".into() |
| 254 | }, | 257 | }, |
| 255 | Modification { | 258 | Modification { |
| 256 | previous_entry_mode: EntryKind::Blob.into(), | 259 | previous_entry_mode: EntryKind::Blob.into(), |
| 257 | previous_oid: hex_to_id("28ce6a8b26aa170e1de65536fe8abe1832bd3242"), | 260 | previous_oid: hex_to_id("28ce6a8b26aa170e1de65536fe8abe1832bd3242", "6ca8d4e3bc5df874055e542d18505b5a5efa0fb7d65776efedc13781073ed0f1"), |
| 258 | entry_mode: EntryKind::Blob.into(), | 261 | entry_mode: EntryKind::Blob.into(), |
| 259 | oid: hex_to_id("13c2aca72ab576cb5f22dc8e7f8ba8ddab553a8a"), | 262 | oid: hex_to_id("13c2aca72ab576cb5f22dc8e7f8ba8ddab553a8a", "ab879bd65609705434bab6bc157306769fd1053c6d86d82c89e76df9bee62809"), |
| 260 | path: "f/f".into() | 263 | path: "f/f".into() |
| 261 | }, | 264 | }, |
| 262 | ], | 265 | ], |
| 263 | ":100644 100644 28ce6a8b26aa170e1de65536fe8abe1832bd3242 13c2aca72ab576cb5f22dc8e7f8ba8ddab553a8a M f/f" | 266 | ":100644 100644 28ce6a8b26aa170e1de65536fe8abe1832bd3242 13c2aca72ab576cb5f22dc8e7f8ba8ddab553a8a M f/f" |
| 264 | ); | 267 | ); |
| 265 | | 268 | |
| 266 | let tree_with_link_id = hex_to_id("7e26dba59b6336f87d1d4ae3505a2da302b91c76"); | 269 | let tree_with_link_id = hex_to_id( |
| 267 | let link_entry_oid = hex_to_id("2e65efe2a145dda7ee51d1741299f848e5bf752e"); | 270 | "7e26dba59b6336f87d1d4ae3505a2da302b91c76", |
| | 271 | "825cbacedb89cffe4fd6532846f376ab9cb8bc9e5cb399620d3592b714c2e95f", |
| | 272 | ); |
| | 273 | let link_entry_oid = hex_to_id( |
| | 274 | "2e65efe2a145dda7ee51d1741299f848e5bf752e", |
| | 275 | "eb337bcee2061c5313c9a1392116b6c76039e9e30d71467ae359b36277e17dc7", |
| | 276 | ); |
| 268 | let link_entry_mode = EntryKind::Link; | 277 | let link_entry_mode = EntryKind::Link; |
| 269 | assert_hash_agnostic_eq!( | 278 | pretty_assertions::assert_eq!( |
| 270 | diff_with_previous_commit_from(&db, &all_commits["f/f mode changed to link"])?, | 279 | diff_with_previous_commit_from(&db, &all_commits["f/f mode changed to link"])?, |
| 271 | vec![ | 280 | vec![ |
| 272 | Modification { | 281 | Modification { |
| 273 | previous_entry_mode: EntryKind::Tree.into(), | 282 | previous_entry_mode: EntryKind::Tree.into(), |
| 274 | previous_oid: hex_to_id("849bd76db90b65ebbd2e6d3970ca70c96ee5592c"), | 283 | previous_oid: hex_to_id("849bd76db90b65ebbd2e6d3970ca70c96ee5592c", "003781d2cca9a680f5ccfe0963614bb813dea1654968713b48a6a27490c3771e"), |
| 275 | entry_mode: EntryKind::Tree.into(), | 284 | entry_mode: EntryKind::Tree.into(), |
| 276 | oid: tree_with_link_id, | 285 | oid: tree_with_link_id, |
| 277 | path: "f".into() | 286 | path: "f".into() |
| 278 | }, | 287 | }, |
| 279 | Modification { | 288 | Modification { |
| 280 | previous_entry_mode: EntryKind::Blob.into(), | 289 | previous_entry_mode: EntryKind::Blob.into(), |
| 281 | previous_oid: hex_to_id("13c2aca72ab576cb5f22dc8e7f8ba8ddab553a8a"), | 290 | previous_oid: hex_to_id("13c2aca72ab576cb5f22dc8e7f8ba8ddab553a8a", "ab879bd65609705434bab6bc157306769fd1053c6d86d82c89e76df9bee62809"), |
| 282 | entry_mode: link_entry_mode.into(), | 291 | entry_mode: link_entry_mode.into(), |
| 283 | oid: link_entry_oid, | 292 | oid: link_entry_oid, |
| 284 | path: "f/f".into() | 293 | path: "f/f".into() |
| @@ -287,12 +296,12 @@ mod changes { · 2 unmodified lines |
| 287 | ":100644 120000 13c2aca72ab576cb5f22dc8e7f8ba8ddab553a8a 2e65efe2a145dda7ee51d1741299f848e5bf752e T f/f" | 296 | ":100644 120000 13c2aca72ab576cb5f22dc8e7f8ba8ddab553a8a 2e65efe2a145dda7ee51d1741299f848e5bf752e T f/f" |
| 288 | ); | 297 | ); |
| 289 | | 298 | |
| 290 | assert_hash_agnostic_eq!( | 299 | pretty_assertions::assert_eq!( |
| 291 | diff_with_previous_commit_from(&db, &all_commits["f/ changed into file f"])?, | 300 | diff_with_previous_commit_from(&db, &all_commits["f/ changed into file f"])?, |
| 292 | vec![ | 301 | vec![ |
| 293 | Addition { | 302 | Addition { |
| 294 | entry_mode: EntryKind::Blob.into(), | 303 | entry_mode: EntryKind::Blob.into(), |
| 295 | oid: hex_to_id("e69de29bb2d1d6434b8b29ae775ad8c2e48c5391"), | 304 | oid: hex_to_id("e69de29bb2d1d6434b8b29ae775ad8c2e48c5391", "473a0f4c3be8a93681a267e3b1e9a7dcda1185436fe141f7749120a303721813"), |
| 296 | path: "f".into(), | 305 | path: "f".into(), |
| 297 | relation: None | 306 | relation: None |
| 298 | }, | 307 | }, |
| @@ -304,13 +313,13 @@ mod changes { · 5 unmodified lines |
| 304 | }, | 313 | }, |
| 305 | Deletion { | 314 | Deletion { |
| 306 | entry_mode: EntryKind::Blob.into(), | 315 | entry_mode: EntryKind::Blob.into(), |
| 307 | oid: hex_to_id("e69de29bb2d1d6434b8b29ae775ad8c2e48c5391"), | 316 | oid: hex_to_id("e69de29bb2d1d6434b8b29ae775ad8c2e48c5391", "473a0f4c3be8a93681a267e3b1e9a7dcda1185436fe141f7749120a303721813"), |
| 308 | path: "f/a".into(), | 317 | path: "f/a".into(), |
| 309 | relation: Some(Relation::ChildOfParent(1)) | 318 | relation: Some(Relation::ChildOfParent(1)) |
| 310 | }, | 319 | }, |
| 311 | Deletion { | 320 | Deletion { |
| 312 | entry_mode: EntryKind::Blob.into(), | 321 | entry_mode: EntryKind::Blob.into(), |
| 313 | oid: hex_to_id("e69de29bb2d1d6434b8b29ae775ad8c2e48c5391"), | 322 | oid: hex_to_id("e69de29bb2d1d6434b8b29ae775ad8c2e48c5391", "473a0f4c3be8a93681a267e3b1e9a7dcda1185436fe141f7749120a303721813"), |
| 314 | path: "f/b".into(), | 323 | path: "f/b".into(), |
| 315 | relation: Some(Relation::ChildOfParent(1)) | 324 | relation: Some(Relation::ChildOfParent(1)) |
| 316 | }, | 325 | }, |
| @@ -326,42 +335,46 @@ mod changes { · 9 unmodified lines |
| 326 | :100644 000000 e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 0000000000000000000000000000000000000000 D f/b | 335 | :100644 000000 e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 0000000000000000000000000000000000000000 D f/b |
| 327 | :120000 000000 2e65efe2a145dda7ee51d1741299f848e5bf752e 0000000000000000000000000000000000000000 D f/f" | 336 | :120000 000000 2e65efe2a145dda7ee51d1741299f848e5bf752e 0000000000000000000000000000000000000000 D f/f" |
| 328 | ); | 337 | ); |
| 329 | assert_hash_agnostic_eq!( | 338 | pretty_assertions::assert_eq!( |
| 330 | diff_with_previous_commit_from(&db, &all_commits["delete d/"])?, | 339 | diff_with_previous_commit_from(&db, &all_commits["delete d/"])?, |
| 331 | vec![ | 340 | vec![ |
| 332 | Deletion { | 341 | Deletion { |
| 333 | entry_mode: EntryKind::Tree.into(), | 342 | entry_mode: EntryKind::Tree.into(), |
| 334 | oid: hex_to_id("3d5a503f4062d198b443db5065ca727f8354e7df"), | 343 | oid: hex_to_id("3d5a503f4062d198b443db5065ca727f8354e7df", "1f5422fc234c61cf503a86521bcafcb86cc48653c5d80d4e93a6cc677e345b40"), |
| 335 | path: "d".into(), | 344 | path: "d".into(), |
| 336 | relation: Some(Relation::Parent(1)) | 345 | relation: Some(Relation::Parent(1)) |
| 337 | }, | 346 | }, |
| 338 | Deletion { | 347 | Deletion { |
| 339 | entry_mode: EntryKind::Blob.into(), | 348 | entry_mode: EntryKind::Blob.into(), |
| 340 | oid: hex_to_id("e69de29bb2d1d6434b8b29ae775ad8c2e48c5391"), | 349 | oid: hex_to_id("e69de29bb2d1d6434b8b29ae775ad8c2e48c5391", "473a0f4c3be8a93681a267e3b1e9a7dcda1185436fe141f7749120a303721813"), |
| 341 | path: "d/f".into(), | 350 | path: "d/f".into(), |
| 342 | relation: Some(Relation::ChildOfParent(1)) | 351 | relation: Some(Relation::ChildOfParent(1)) |
| 343 | }, | 352 | }, |
| 344 | ], | 353 | ], |
| 345 | ":100644 000000 e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 0000000000000000000000000000000000000000 D d/f" | 354 | ":100644 000000 e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 0000000000000000000000000000000000000000 D d/f" |
| 346 | ); | 355 | ); |
| 347 | assert_hash_agnostic_eq!( | 356 | let empty_blob_id = hex_to_id( |
| | 357 | "e69de29bb2d1d6434b8b29ae775ad8c2e48c5391", |
| | 358 | "473a0f4c3be8a93681a267e3b1e9a7dcda1185436fe141f7749120a303721813", |
| | 359 | ); |
| | 360 | pretty_assertions::assert_eq!( |
| 348 | diff_with_previous_commit_from(&db, &all_commits["add /c /d /e"])?, | 361 | diff_with_previous_commit_from(&db, &all_commits["add /c /d /e"])?, |
| 349 | vec![ | 362 | vec![ |
| 350 | Addition { | 363 | Addition { |
| 351 | entry_mode: EntryKind::Blob.into(), | 364 | entry_mode: EntryKind::Blob.into(), |
| 352 | oid: hex_to_id("e69de29bb2d1d6434b8b29ae775ad8c2e48c5391"), | 365 | oid: empty_blob_id, |
| 353 | path: "c".into(), | 366 | path: "c".into(), |
| 354 | relation: None, | 367 | relation: None, |
| 355 | }, | 368 | }, |
| 356 | Addition { | 369 | Addition { |
| 357 | entry_mode: EntryKind::Blob.into(), | 370 | entry_mode: EntryKind::Blob.into(), |
| 358 | oid: hex_to_id("e69de29bb2d1d6434b8b29ae775ad8c2e48c5391"), | 371 | oid: empty_blob_id, |
| 359 | path: "d".into(), | 372 | path: "d".into(), |
| 360 | relation: None, | 373 | relation: None, |
| 361 | }, | 374 | }, |
| 362 | Addition { | 375 | Addition { |
| 363 | entry_mode: EntryKind::Blob.into(), | 376 | entry_mode: EntryKind::Blob.into(), |
| 364 | oid: hex_to_id("e69de29bb2d1d6434b8b29ae775ad8c2e48c5391"), | 377 | oid: empty_blob_id, |
| 365 | path: "e".into(), | 378 | path: "e".into(), |
| 366 | relation: None, | 379 | relation: None, |
| 367 | }, | 380 | }, |
| @@ -370,42 +383,42 @@ mod changes { · 2 unmodified lines |
| 370 | :000000 100644 0000000000000000000000000000000000000000 e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 A d | 383 | :000000 100644 0000000000000000000000000000000000000000 e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 A d |
| 371 | :000000 100644 0000000000000000000000000000000000000000 e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 A e" | 384 | :000000 100644 0000000000000000000000000000000000000000 e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 A e" |
| 372 | ); | 385 | ); |
| 373 | assert_hash_agnostic_eq!( | 386 | pretty_assertions::assert_eq!( |
| 374 | diff_with_previous_commit_from(&db, &all_commits["add g/a"])?, | 387 | diff_with_previous_commit_from(&db, &all_commits["add g/a"])?, |
| 375 | vec![ | 388 | vec![ |
| 376 | Addition { | 389 | Addition { |
| 377 | entry_mode: EntryKind::Tree.into(), | 390 | entry_mode: EntryKind::Tree.into(), |
| 378 | oid: hex_to_id("496d6428b9cf92981dc9495211e6e1120fb6f2ba"), | 391 | oid: hex_to_id("496d6428b9cf92981dc9495211e6e1120fb6f2ba", "5f6f307bcc469c02acba4f7da42d8d4defdda8209777fe732956f1e2fa0db3ff"), |
| 379 | path: "g".into(), | 392 | path: "g".into(), |
| 380 | relation: Some(Relation::Parent(1)) | 393 | relation: Some(Relation::Parent(1)) |
| 381 | }, | 394 | }, |
| 382 | Addition { | 395 | Addition { |
| 383 | entry_mode: EntryKind::Blob.into(), | 396 | entry_mode: EntryKind::Blob.into(), |
| 384 | oid: hex_to_id("e69de29bb2d1d6434b8b29ae775ad8c2e48c5391"), | 397 | oid: hex_to_id("e69de29bb2d1d6434b8b29ae775ad8c2e48c5391", "473a0f4c3be8a93681a267e3b1e9a7dcda1185436fe141f7749120a303721813"), |
| 385 | path: "g/a".into(), | 398 | path: "g/a".into(), |
| 386 | relation: Some(Relation::ChildOfParent(1)) | 399 | relation: Some(Relation::ChildOfParent(1)) |
| 387 | }, | 400 | }, |
| 388 | ], | 401 | ], |
| 389 | ":000000 100644 0000000000000000000000000000000000000000 e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 A g/a" | 402 | ":000000 100644 0000000000000000000000000000000000000000 e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 A g/a" |
| 390 | ); | 403 | ); |
| 391 | assert_hash_agnostic_eq!( | 404 | pretty_assertions::assert_eq!( |
| 392 | diff_with_previous_commit_from(&db, &all_commits["remove /c /d /e"])?, | 405 | diff_with_previous_commit_from(&db, &all_commits["remove /c /d /e"])?, |
| 393 | vec![ | 406 | vec![ |
| 394 | Deletion { | 407 | Deletion { |
| 395 | entry_mode: EntryKind::Blob.into(), | 408 | entry_mode: EntryKind::Blob.into(), |
| 396 | oid: hex_to_id("e69de29bb2d1d6434b8b29ae775ad8c2e48c5391"), | 409 | oid: empty_blob_id, |
| 397 | path: "c".into(), | 410 | path: "c".into(), |
| 398 | relation: None | 411 | relation: None |
| 399 | }, | 412 | }, |
| 400 | Deletion { | 413 | Deletion { |
| 401 | entry_mode: EntryKind::Blob.into(), | 414 | entry_mode: EntryKind::Blob.into(), |
| 402 | oid: hex_to_id("e69de29bb2d1d6434b8b29ae775ad8c2e48c5391"), | 415 | oid: empty_blob_id, |
| 403 | path: "d".into(), | 416 | path: "d".into(), |
| 404 | relation: None | 417 | relation: None |
| 405 | }, | 418 | }, |
| 406 | Deletion { | 419 | Deletion { |
| 407 | entry_mode: EntryKind::Blob.into(), | 420 | entry_mode: EntryKind::Blob.into(), |
| 408 | oid: hex_to_id("e69de29bb2d1d6434b8b29ae775ad8c2e48c5391"), | 421 | oid: empty_blob_id, |
| 409 | path: "e".into(), | 422 | path: "e".into(), |
| 410 | relation: None | 423 | relation: None |
| 411 | }, | 424 | }, |
| @@ -414,18 +427,18 @@ mod changes { · 2 unmodified lines |
| 414 | :100644 000000 e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 0000000000000000000000000000000000000000 D d | 427 | :100644 000000 e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 0000000000000000000000000000000000000000 D d |
| 415 | :100644 000000 e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 0000000000000000000000000000000000000000 D e" | 428 | :100644 000000 e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 0000000000000000000000000000000000000000 D e" |
| 416 | ); | 429 | ); |
| 417 | assert_hash_agnostic_eq!( | 430 | pretty_assertions::assert_eq!( |
| 418 | diff_with_previous_commit_from(&db, &all_commits["rm /f, add /ff"])?, | 431 | diff_with_previous_commit_from(&db, &all_commits["rm /f, add /ff"])?, |
| 419 | vec![ | 432 | vec![ |
| 420 | Deletion { | 433 | Deletion { |
| 421 | entry_mode: EntryKind::Blob.into(), | 434 | entry_mode: EntryKind::Blob.into(), |
| 422 | oid: hex_to_id("e69de29bb2d1d6434b8b29ae775ad8c2e48c5391"), | 435 | oid: hex_to_id("e69de29bb2d1d6434b8b29ae775ad8c2e48c5391", "473a0f4c3be8a93681a267e3b1e9a7dcda1185436fe141f7749120a303721813"), |
| 423 | path: "f".into(), | 436 | path: "f".into(), |
| 424 | relation: None | 437 | relation: None |
| 425 | }, | 438 | }, |
| 426 | Addition { | 439 | Addition { |
| 427 | entry_mode: EntryKind::Blob.into(), | 440 | entry_mode: EntryKind::Blob.into(), |
| 428 | oid: hex_to_id("e69de29bb2d1d6434b8b29ae775ad8c2e48c5391"), | 441 | oid: hex_to_id("e69de29bb2d1d6434b8b29ae775ad8c2e48c5391", "473a0f4c3be8a93681a267e3b1e9a7dcda1185436fe141f7749120a303721813"), |
| 429 | path: "ff".into(), | 442 | path: "ff".into(), |
| 430 | relation: None | 443 | relation: None |
| 431 | }, | 444 | }, |
| @@ -433,25 +446,25 @@ mod changes { · 1 unmodified line |
| 433 | ":100644 000000 e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 0000000000000000000000000000000000000000 D f | 446 | ":100644 000000 e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 0000000000000000000000000000000000000000 D f |
| 434 | :000000 100644 0000000000000000000000000000000000000000 e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 A ff" | 447 | :000000 100644 0000000000000000000000000000000000000000 e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 A ff" |
| 435 | ); | 448 | ); |
| 436 | assert_hash_agnostic_eq!( | 449 | pretty_assertions::assert_eq!( |
| 437 | diff_with_previous_commit_from(&db, &all_commits["rm g/a, add g/aa"])?, | 450 | diff_with_previous_commit_from(&db, &all_commits["rm g/a, add g/aa"])?, |
| 438 | vec![ | 451 | vec![ |
| 439 | Modification { | 452 | Modification { |
| 440 | previous_entry_mode: EntryKind::Tree.into(), | 453 | previous_entry_mode: EntryKind::Tree.into(), |
| 441 | previous_oid: hex_to_id("496d6428b9cf92981dc9495211e6e1120fb6f2ba"), | 454 | previous_oid: hex_to_id("496d6428b9cf92981dc9495211e6e1120fb6f2ba", "5f6f307bcc469c02acba4f7da42d8d4defdda8209777fe732956f1e2fa0db3ff"), |
| 442 | entry_mode: EntryKind::Tree.into(), | 455 | entry_mode: EntryKind::Tree.into(), |
| 443 | oid: hex_to_id("6e5931346904b020301f74f581142826eacc4678"), | 456 | oid: hex_to_id("6e5931346904b020301f74f581142826eacc4678", "c56aa83b78552302a7ab7c6377d8a54573a3845e10242df3eae849394ab91b53"), |
| 444 | path: "g".into() | 457 | path: "g".into() |
| 445 | }, | 458 | }, |
| 446 | Deletion { | 459 | Deletion { |
| 447 | entry_mode: EntryKind::Blob.into(), | 460 | entry_mode: EntryKind::Blob.into(), |
| 448 | oid: hex_to_id("e69de29bb2d1d6434b8b29ae775ad8c2e48c5391"), | 461 | oid: hex_to_id("e69de29bb2d1d6434b8b29ae775ad8c2e48c5391", "473a0f4c3be8a93681a267e3b1e9a7dcda1185436fe141f7749120a303721813"), |
| 449 | path: "g/a".into(), | 462 | path: "g/a".into(), |
| 450 | relation: None | 463 | relation: None |
| 451 | }, | 464 | }, |
| 452 | Addition { | 465 | Addition { |
| 453 | entry_mode: EntryKind::Blob.into(), | 466 | entry_mode: EntryKind::Blob.into(), |
| 454 | oid: hex_to_id("e69de29bb2d1d6434b8b29ae775ad8c2e48c5391"), | 467 | oid: hex_to_id("e69de29bb2d1d6434b8b29ae775ad8c2e48c5391", "473a0f4c3be8a93681a267e3b1e9a7dcda1185436fe141f7749120a303721813"), |
| 455 | path: "g/aa".into(), | 468 | path: "g/aa".into(), |
| 456 | relation: None | 469 | relation: None |
| 457 | }, | 470 | }, |
| @@ -459,18 +472,18 @@ mod changes { · 1 unmodified line |
| 459 | ":100644 000000 e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 0000000000000000000000000000000000000000 D g/a | 472 | ":100644 000000 e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 0000000000000000000000000000000000000000 D g/a |
| 460 | :000000 100644 0000000000000000000000000000000000000000 e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 A g/aa" | 473 | :000000 100644 0000000000000000000000000000000000000000 e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 A g/aa" |
| 461 | ); | 474 | ); |
| 462 | assert_hash_agnostic_eq!( | 475 | pretty_assertions::assert_eq!( |
| 463 | diff_with_previous_commit_from(&db, &all_commits["rm /ff, add /f"])?, | 476 | diff_with_previous_commit_from(&db, &all_commits["rm /ff, add /f"])?, |
| 464 | vec![ | 477 | vec![ |
| 465 | Addition { | 478 | Addition { |
| 466 | entry_mode: EntryKind::Blob.into(), | 479 | entry_mode: EntryKind::Blob.into(), |
| 467 | oid: hex_to_id("e69de29bb2d1d6434b8b29ae775ad8c2e48c5391"), | 480 | oid: hex_to_id("e69de29bb2d1d6434b8b29ae775ad8c2e48c5391", "473a0f4c3be8a93681a267e3b1e9a7dcda1185436fe141f7749120a303721813"), |
| 468 | path: "f".into(), | 481 | path: "f".into(), |
| 469 | relation: None, | 482 | relation: None, |
| 470 | }, | 483 | }, |
| 471 | Deletion { | 484 | Deletion { |
| 472 | entry_mode: EntryKind::Blob.into(), | 485 | entry_mode: EntryKind::Blob.into(), |
| 473 | oid: hex_to_id("e69de29bb2d1d6434b8b29ae775ad8c2e48c5391"), | 486 | oid: hex_to_id("e69de29bb2d1d6434b8b29ae775ad8c2e48c5391", "473a0f4c3be8a93681a267e3b1e9a7dcda1185436fe141f7749120a303721813"), |
| 474 | path: "ff".into(), | 487 | path: "ff".into(), |
| 475 | relation: None, | 488 | relation: None, |
| 476 | }, | 489 | }, |
| @@ -478,25 +491,25 @@ mod changes { · 1 unmodified line |
| 478 | ":100644 000000 e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 0000000000000000000000000000000000000000 D f | 491 | ":100644 000000 e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 0000000000000000000000000000000000000000 D f |
| 479 | :000000 100644 0000000000000000000000000000000000000000 e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 A ff" | 492 | :000000 100644 0000000000000000000000000000000000000000 e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 A ff" |
| 480 | ); | 493 | ); |
| 481 | assert_hash_agnostic_eq!( | 494 | pretty_assertions::assert_eq!( |
| 482 | diff_with_previous_commit_from(&db, &all_commits["rm g/aa, add g/a"])?, | 495 | diff_with_previous_commit_from(&db, &all_commits["rm g/aa, add g/a"])?, |
| 483 | vec![ | 496 | vec![ |
| 484 | Modification { | 497 | Modification { |
| 485 | previous_entry_mode: EntryKind::Tree.into(), | 498 | previous_entry_mode: EntryKind::Tree.into(), |
| 486 | previous_oid: hex_to_id("6e5931346904b020301f74f581142826eacc4678"), | 499 | previous_oid: hex_to_id("6e5931346904b020301f74f581142826eacc4678", "c56aa83b78552302a7ab7c6377d8a54573a3845e10242df3eae849394ab91b53"), |
| 487 | entry_mode: EntryKind::Tree.into(), | 500 | entry_mode: EntryKind::Tree.into(), |
| 488 | oid: hex_to_id("496d6428b9cf92981dc9495211e6e1120fb6f2ba"), | 501 | oid: hex_to_id("496d6428b9cf92981dc9495211e6e1120fb6f2ba", "5f6f307bcc469c02acba4f7da42d8d4defdda8209777fe732956f1e2fa0db3ff"), |
| 489 | path: "g".into() | 502 | path: "g".into() |
| 490 | }, | 503 | }, |
| 491 | Addition { | 504 | Addition { |
| 492 | entry_mode: EntryKind::Blob.into(), | 505 | entry_mode: EntryKind::Blob.into(), |
| 493 | oid: hex_to_id("e69de29bb2d1d6434b8b29ae775ad8c2e48c5391"), | 506 | oid: hex_to_id("e69de29bb2d1d6434b8b29ae775ad8c2e48c5391", "473a0f4c3be8a93681a267e3b1e9a7dcda1185436fe141f7749120a303721813"), |
| 494 | path: "g/a".into(), | 507 | path: "g/a".into(), |
| 495 | relation: None, | 508 | relation: None, |
| 496 | }, | 509 | }, |
| 497 | Deletion { | 510 | Deletion { |
| 498 | entry_mode: EntryKind::Blob.into(), | 511 | entry_mode: EntryKind::Blob.into(), |
| 499 | oid: hex_to_id("e69de29bb2d1d6434b8b29ae775ad8c2e48c5391"), | 512 | oid: hex_to_id("e69de29bb2d1d6434b8b29ae775ad8c2e48c5391", "473a0f4c3be8a93681a267e3b1e9a7dcda1185436fe141f7749120a303721813"), |
| 500 | path: "g/aa".into(), | 513 | path: "g/aa".into(), |
| 501 | relation: None, | 514 | relation: None, |
| 502 | }, | 515 | }, |
| @@ -512,39 +525,39 @@ mod changes { · 9 unmodified lines |
| 512 | let db = db(["a"].iter().copied())?; | 525 | let db = db(["a"].iter().copied())?; |
| 513 | let all_commits = all_commits(&db); | 526 | let all_commits = all_commits(&db); |
| 514 | | 527 | |
| 515 | assert_hash_agnostic_eq!( | 528 | pretty_assertions::assert_eq!( |
| 516 | diff_with_previous_commit_from(&db, &all_commits["f added"])?, | 529 | diff_with_previous_commit_from(&db, &all_commits["f added"])?, |
| 517 | vec![ | 530 | vec![ |
| 518 | Addition { | 531 | Addition { |
| 519 | entry_mode: EntryKind::Tree.into(), | 532 | entry_mode: EntryKind::Tree.into(), |
| 520 | oid: hex_to_id("3d5a503f4062d198b443db5065ca727f8354e7df"), | 533 | oid: hex_to_id("3d5a503f4062d198b443db5065ca727f8354e7df", "1f5422fc234c61cf503a86521bcafcb86cc48653c5d80d4e93a6cc677e345b40"), |
| 521 | path: "a".into(), | 534 | path: "a".into(), |
| 522 | relation: Some(Relation::Parent(1)), | 535 | relation: Some(Relation::Parent(1)), |
| 523 | }, | 536 | }, |
| 524 | Addition { | 537 | Addition { |
| 525 | entry_mode: EntryKind::Blob.into(), | 538 | entry_mode: EntryKind::Blob.into(), |
| 526 | oid: hex_to_id("e69de29bb2d1d6434b8b29ae775ad8c2e48c5391"), | 539 | oid: hex_to_id("e69de29bb2d1d6434b8b29ae775ad8c2e48c5391", "473a0f4c3be8a93681a267e3b1e9a7dcda1185436fe141f7749120a303721813"), |
| 527 | path: "a/f".into(), | 540 | path: "a/f".into(), |
| 528 | relation: Some(Relation::ChildOfParent(1)), | 541 | relation: Some(Relation::ChildOfParent(1)), |
| 529 | } | 542 | } |
| 530 | ], | 543 | ], |
| 531 | ":000000 100644 0000000000000000000000000000000000000000 e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 A a/f" | 544 | ":000000 100644 0000000000000000000000000000000000000000 e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 A a/f" |
| 532 | ); | 545 | ); |
| 533 | assert_hash_agnostic_eq!( | 546 | pretty_assertions::assert_eq!( |
| 534 | diff_with_previous_commit_from(&db, &all_commits["f modified"])?, | 547 | diff_with_previous_commit_from(&db, &all_commits["f modified"])?, |
| 535 | vec![ | 548 | vec![ |
| 536 | Modification { | 549 | Modification { |
| 537 | previous_entry_mode: EntryKind::Tree.into(), | 550 | previous_entry_mode: EntryKind::Tree.into(), |
| 538 | previous_oid: hex_to_id("3d5a503f4062d198b443db5065ca727f8354e7df"), | 551 | previous_oid: hex_to_id("3d5a503f4062d198b443db5065ca727f8354e7df", "1f5422fc234c61cf503a86521bcafcb86cc48653c5d80d4e93a6cc677e345b40"), |
| 539 | entry_mode: EntryKind::Tree.into(), | 552 | entry_mode: EntryKind::Tree.into(), |
| 540 | oid: hex_to_id("10f2f4b82222d2b5c31985130979a91fd87410f7"), | 553 | oid: hex_to_id("10f2f4b82222d2b5c31985130979a91fd87410f7", "9e220e584599b9cff376b638fa71675280f4582a87138b6be425258dbb85f94c"), |
| 541 | path: "a".into() | 554 | path: "a".into() |
| 542 | }, | 555 | }, |
| 543 | Modification { | 556 | Modification { |
| 544 | previous_entry_mode: EntryKind::Blob.into(), | 557 | previous_entry_mode: EntryKind::Blob.into(), |
| 545 | previous_oid: hex_to_id("e69de29bb2d1d6434b8b29ae775ad8c2e48c5391"), | 558 | previous_oid: hex_to_id("e69de29bb2d1d6434b8b29ae775ad8c2e48c5391", "473a0f4c3be8a93681a267e3b1e9a7dcda1185436fe141f7749120a303721813"), |
| 546 | entry_mode: EntryKind::Blob.into(), | 559 | entry_mode: EntryKind::Blob.into(), |
| 547 | oid: hex_to_id("28ce6a8b26aa170e1de65536fe8abe1832bd3242"), | 560 | oid: hex_to_id("28ce6a8b26aa170e1de65536fe8abe1832bd3242", "6ca8d4e3bc5df874055e542d18505b5a5efa0fb7d65776efedc13781073ed0f1"), |
| 548 | path: "a/f".into() | 561 | path: "a/f".into() |
| 549 | } | 562 | } |
| 550 | ], | 563 | ], |
| @@ -567,47 +580,57 @@ mod changes { · 16 unmodified lines |
| 567 | | 580 | |
| 568 | let last_commit = all_commits["rm g/aa, add g/a"]; | 581 | let last_commit = all_commits["rm g/aa, add g/a"]; |
| 569 | let first_commit = all_commits["f added"]; | 582 | let first_commit = all_commits["f added"]; |
| 570 | assert_hash_agnostic_eq!( | 583 | let empty_blob_id = hex_to_id( |
| | 584 | "e69de29bb2d1d6434b8b29ae775ad8c2e48c5391", |
| | 585 | "473a0f4c3be8a93681a267e3b1e9a7dcda1185436fe141f7749120a303721813", |
| | 586 | ); |
| | 587 | pretty_assertions::assert_eq!( |
| 571 | diff_commits(&db, first_commit.to_owned(), &last_commit, None)?, | 588 | diff_commits(&db, first_commit.to_owned(), &last_commit, None)?, |
| 572 | vec![ | 589 | vec![ |
| 573 | Addition { | 590 | Addition { |
| 574 | entry_mode: EntryKind::Blob.into(), | 591 | entry_mode: EntryKind::Blob.into(), |
| 575 | oid: hex_to_id("e69de29bb2d1d6434b8b29ae775ad8c2e48c5391"), | 592 | oid: empty_blob_id, |
| 576 | path: "".into(), | 593 | path: "".into(), |
| 577 | relation: None | 594 | relation: None |
| 578 | }, | 595 | }, |
| 579 | Addition { | 596 | Addition { |
| 580 | entry_mode: EntryKind::Tree.into(), | 597 | entry_mode: EntryKind::Tree.into(), |
| 581 | oid: hex_to_id("496d6428b9cf92981dc9495211e6e1120fb6f2ba"), | 598 | oid: hex_to_id( |
| | 599 | "496d6428b9cf92981dc9495211e6e1120fb6f2ba", |
| | 600 | "5f6f307bcc469c02acba4f7da42d8d4defdda8209777fe732956f1e2fa0db3ff" |
| | 601 | ), |
| 582 | path: "".into(), | 602 | path: "".into(), |
| 583 | relation: Some(Relation::Parent(1)) | 603 | relation: Some(Relation::Parent(1)) |
| 584 | }, | 604 | }, |
| 585 | Addition { | 605 | Addition { |
| 586 | entry_mode: EntryKind::Blob.into(), | 606 | entry_mode: EntryKind::Blob.into(), |
| 587 | oid: hex_to_id("e69de29bb2d1d6434b8b29ae775ad8c2e48c5391"), | 607 | oid: empty_blob_id, |
| 588 | path: "".into(), | 608 | path: "".into(), |
| 589 | relation: Some(Relation::ChildOfParent(1)) | 609 | relation: Some(Relation::ChildOfParent(1)) |
| 590 | } | 610 | } |
| 591 | ] | 611 | ] |
| 592 | ); | 612 | ); |
| 593 | assert_hash_agnostic_eq!( | 613 | pretty_assertions::assert_eq!( |
| 594 | diff_commits(&db, last_commit.to_owned(), &first_commit, Location::FileName.into())?, | 614 | diff_commits(&db, last_commit.to_owned(), &first_commit, Location::FileName.into())?, |
| 595 | vec![ | 615 | vec![ |
| 596 | Deletion { | 616 | Deletion { |
| 597 | entry_mode: EntryKind::Blob.into(), | 617 | entry_mode: EntryKind::Blob.into(), |
| 598 | oid: hex_to_id("e69de29bb2d1d6434b8b29ae775ad8c2e48c5391"), | 618 | oid: empty_blob_id, |
| 599 | path: "b".into(), | 619 | path: "b".into(), |
| 600 | relation: None | 620 | relation: None |
| 601 | }, | 621 | }, |
| 602 | Deletion { | 622 | Deletion { |
| 603 | entry_mode: EntryKind::Tree.into(), | 623 | entry_mode: EntryKind::Tree.into(), |
| 604 | oid: hex_to_id("496d6428b9cf92981dc9495211e6e1120fb6f2ba"), | 624 | oid: hex_to_id( |
| | 625 | "496d6428b9cf92981dc9495211e6e1120fb6f2ba", |
| | 626 | "5f6f307bcc469c02acba4f7da42d8d4defdda8209777fe732956f1e2fa0db3ff" |
| | 627 | ), |
| 605 | path: "g".into(), | 628 | path: "g".into(), |
| 606 | relation: Some(Relation::Parent(1)) | 629 | relation: Some(Relation::Parent(1)) |
| 607 | }, | 630 | }, |
| 608 | Deletion { | 631 | Deletion { |
| 609 | entry_mode: EntryKind::Blob.into(), | 632 | entry_mode: EntryKind::Blob.into(), |
| 610 | oid: hex_to_id("e69de29bb2d1d6434b8b29ae775ad8c2e48c5391"), | 633 | oid: empty_blob_id, |
| 611 | path: "a".into(), | 634 | path: "a".into(), |
| 612 | relation: Some(Relation::ChildOfParent(1)) | 635 | relation: Some(Relation::ChildOfParent(1)) |
| 613 | } | 636 | } |
| @@ -620,55 +643,65 @@ mod changes { · 6 unmodified lines |
| 620 | fn maximal_difference_nested() -> crate::Result { | 643 | fn maximal_difference_nested() -> crate::Result { |
| 621 | let db = db(["a"].iter().copied())?; | 644 | let db = db(["a"].iter().copied())?; |
| 622 | let all_commits = all_commits(&db); | 645 | let all_commits = all_commits(&db); |
| | 646 | let empty_blob_id = hex_to_id( |
| | 647 | "e69de29bb2d1d6434b8b29ae775ad8c2e48c5391", |
| | 648 | "473a0f4c3be8a93681a267e3b1e9a7dcda1185436fe141f7749120a303721813", |
| | 649 | ); |
| 623 | | 650 | |
| 624 | assert_hash_agnostic_eq!( | 651 | pretty_assertions::assert_eq!( |
| 625 | diff_commits(&db, None::<ObjectId>, &all_commits["add g/a"], Some(Location::Path))?, | 652 | diff_commits(&db, None::<ObjectId>, &all_commits["add g/a"], Some(Location::Path))?, |
| 626 | vec![ | 653 | vec![ |
| 627 | Addition { | 654 | Addition { |
| 628 | entry_mode: EntryKind::Tree.into(), | 655 | entry_mode: EntryKind::Tree.into(), |
| 629 | oid: hex_to_id("0df4d0ed769eacd0a231e7512fca25d3cabdeca4"), | 656 | oid: hex_to_id( |
| | 657 | "0df4d0ed769eacd0a231e7512fca25d3cabdeca4", |
| | 658 | "dac24a12e6d43c6ad271e7ea4f021093dac44f15f99317b2e0d54753b4f09099" |
| | 659 | ), |
| 630 | path: "a".into(), | 660 | path: "a".into(), |
| 631 | relation: Some(Relation::Parent(1)), | 661 | relation: Some(Relation::Parent(1)), |
| 632 | }, | 662 | }, |
| 633 | Addition { | 663 | Addition { |
| 634 | entry_mode: EntryKind::Blob.into(), | 664 | entry_mode: EntryKind::Blob.into(), |
| 635 | oid: hex_to_id("e69de29bb2d1d6434b8b29ae775ad8c2e48c5391"), | 665 | oid: empty_blob_id, |
| 636 | path: "a/b".into(), | 666 | path: "a/b".into(), |
| 637 | relation: Some(Relation::ChildOfParent(1)), | 667 | relation: Some(Relation::ChildOfParent(1)), |
| 638 | }, | 668 | }, |
| 639 | Addition { | 669 | Addition { |
| 640 | entry_mode: EntryKind::Blob.into(), | 670 | entry_mode: EntryKind::Blob.into(), |
| 641 | oid: hex_to_id("e69de29bb2d1d6434b8b29ae775ad8c2e48c5391"), | 671 | oid: empty_blob_id, |
| 642 | path: "a/c".into(), | 672 | path: "a/c".into(), |
| 643 | relation: Some(Relation::ChildOfParent(1)), | 673 | relation: Some(Relation::ChildOfParent(1)), |
| 644 | }, | 674 | }, |
| 645 | Addition { | 675 | Addition { |
| 646 | entry_mode: EntryKind::Blob.into(), | 676 | entry_mode: EntryKind::Blob.into(), |
| 647 | oid: hex_to_id("e69de29bb2d1d6434b8b29ae775ad8c2e48c5391"), | 677 | oid: empty_blob_id, |
| 648 | path: "a/d".into(), | 678 | path: "a/d".into(), |
| 649 | relation: Some(Relation::ChildOfParent(1)), | 679 | relation: Some(Relation::ChildOfParent(1)), |
| 650 | }, | 680 | }, |
| 651 | Addition { | 681 | Addition { |
| 652 | entry_mode: EntryKind::Blob.into(), | 682 | entry_mode: EntryKind::Blob.into(), |
| 653 | oid: hex_to_id("e69de29bb2d1d6434b8b29ae775ad8c2e48c5391"), | 683 | oid: empty_blob_id, |
| 654 | path: "a/e".into(), | 684 | path: "a/e".into(), |
| 655 | relation: Some(Relation::ChildOfParent(1)), | 685 | relation: Some(Relation::ChildOfParent(1)), |
| 656 | }, | 686 | }, |
| 657 | Addition { | 687 | Addition { |
| 658 | entry_mode: EntryKind::Blob.into(), | 688 | entry_mode: EntryKind::Blob.into(), |
| 659 | oid: hex_to_id("e69de29bb2d1d6434b8b29ae775ad8c2e48c5391"), | 689 | oid: empty_blob_id, |
| 660 | path: "a/f".into(), | 690 | path: "a/f".into(), |
| 661 | relation: Some(Relation::ChildOfParent(1)), | 691 | relation: Some(Relation::ChildOfParent(1)), |
| 662 | }, | 692 | }, |
| 663 | Addition { | 693 | Addition { |
| 664 | entry_mode: EntryKind::Tree.into(), | 694 | entry_mode: EntryKind::Tree.into(), |
| 665 | oid: hex_to_id("496d6428b9cf92981dc9495211e6e1120fb6f2ba"), | 695 | oid: hex_to_id( |
| | 696 | "496d6428b9cf92981dc9495211e6e1120fb6f2ba", |
| | 697 | "5f6f307bcc469c02acba4f7da42d8d4defdda8209777fe732956f1e2fa0db3ff" |
| | 698 | ), |
| 666 | path: "a/g".into(), | 699 | path: "a/g".into(), |
| 667 | relation: Some(Relation::ChildOfParent(1)), | 700 | relation: Some(Relation::ChildOfParent(1)), |
| 668 | }, | 701 | }, |
| 669 | Addition { | 702 | Addition { |
| 670 | entry_mode: EntryKind::Blob.into(), | 703 | entry_mode: EntryKind::Blob.into(), |
| 671 | oid: hex_to_id("e69de29bb2d1d6434b8b29ae775ad8c2e48c5391"), | 704 | oid: empty_blob_id, |
| 672 | path: "a/g/a".into(), | 705 | path: "a/g/a".into(), |
| 673 | relation: Some(Relation::ChildOfParent(1)), | 706 | relation: Some(Relation::ChildOfParent(1)), |
| 674 | } | 707 | } |
| @@ -681,67 +714,83 @@ mod changes { · 6 unmodified lines |
| 681 | fn directory_rename() -> crate::Result { | 714 | fn directory_rename() -> crate::Result { |
| 682 | let db = db(None)?; | 715 | let db = db(None)?; |
| 683 | let all_commits = all_commits(&db); | 716 | let all_commits = all_commits(&db); |
| | 717 | let empty_blob_id = hex_to_id( |
| | 718 | "e69de29bb2d1d6434b8b29ae775ad8c2e48c5391", |
| | 719 | "473a0f4c3be8a93681a267e3b1e9a7dcda1185436fe141f7749120a303721813", |
| | 720 | ); |
| 684 | | 721 | |
| 685 | assert_hash_agnostic_eq!( | 722 | pretty_assertions::assert_eq!( |
| 686 | diff_with_previous_commit_from(&db, &all_commits["rename git-sec to gix-sec"])?, | 723 | diff_with_previous_commit_from(&db, &all_commits["rename git-sec to gix-sec"])?, |
| 687 | vec![ | 724 | vec![ |
| 688 | Deletion { | 725 | Deletion { |
| 689 | entry_mode: EntryKind::Tree.into(), | 726 | entry_mode: EntryKind::Tree.into(), |
| 690 | oid: hex_to_id("d8c30fb72173778ed57fac5813c5e37038a8746c"), | 727 | oid: hex_to_id( |
| | 728 | "d8c30fb72173778ed57fac5813c5e37038a8746c", |
| | 729 | "52a70042eff6fbeed1d6c8c0ed2f9cc775a19cc51b395429c4210bc5091520ad" |
| | 730 | ), |
| 691 | path: "git-sec".into(), | 731 | path: "git-sec".into(), |
| 692 | relation: Some(Relation::Parent(1)), | 732 | relation: Some(Relation::Parent(1)), |
| 693 | }, | 733 | }, |
| 694 | Addition { | 734 | Addition { |
| 695 | entry_mode: EntryKind::Tree.into(), | 735 | entry_mode: EntryKind::Tree.into(), |
| 696 | oid: hex_to_id("d8c30fb72173778ed57fac5813c5e37038a8746c"), | 736 | oid: hex_to_id( |
| | 737 | "d8c30fb72173778ed57fac5813c5e37038a8746c", |
| | 738 | "52a70042eff6fbeed1d6c8c0ed2f9cc775a19cc51b395429c4210bc5091520ad" |
| | 739 | ), |
| 697 | path: "gix-sec".into(), | 740 | path: "gix-sec".into(), |
| 698 | relation: Some(Relation::Parent(2)), | 741 | relation: Some(Relation::Parent(2)), |
| 699 | }, | 742 | }, |
| 700 | Deletion { | 743 | Deletion { |
| 701 | entry_mode: EntryKind::Blob.into(), | 744 | entry_mode: EntryKind::Blob.into(), |
| 702 | oid: hex_to_id("e69de29bb2d1d6434b8b29ae775ad8c2e48c5391"), | 745 | oid: empty_blob_id, |
| 703 | path: "git-sec/2".into(), | 746 | path: "git-sec/2".into(), |
| 704 | relation: Some(Relation::ChildOfParent(1)), | 747 | relation: Some(Relation::ChildOfParent(1)), |
| 705 | }, | 748 | }, |
| 706 | Deletion { | 749 | Deletion { |
| 707 | entry_mode: EntryKind::Blob.into(), | 750 | entry_mode: EntryKind::Blob.into(), |
| 708 | oid: hex_to_id("e69de29bb2d1d6434b8b29ae775ad8c2e48c5391"), | 751 | oid: empty_blob_id, |
| 709 | path: "git-sec/7".into(), | 752 | path: "git-sec/7".into(), |
| 710 | relation: Some(Relation::ChildOfParent(1)), | 753 | relation: Some(Relation::ChildOfParent(1)), |
| 711 | }, | 754 | }, |
| 712 | Deletion { | 755 | Deletion { |
| 713 | entry_mode: EntryKind::Tree.into(), | 756 | entry_mode: EntryKind::Tree.into(), |
| 714 | oid: hex_to_id("fd7938a0c18f993c89eda3f40a6d06fa6785833c"), | 757 | oid: hex_to_id( |
| | 758 | "fd7938a0c18f993c89eda3f40a6d06fa6785833c", |
| | 759 | "5b2e08d098c63c2f31c8937c810f77ff005c48833701e0854f690188f1887aae" |
| | 760 | ), |
| 715 | path: "git-sec/subdir".into(), | 761 | path: "git-sec/subdir".into(), |
| 716 | relation: Some(Relation::ChildOfParent(1)), | 762 | relation: Some(Relation::ChildOfParent(1)), |
| 717 | }, | 763 | }, |
| 718 | Addition { | 764 | Addition { |
| 719 | entry_mode: EntryKind::Blob.into(), | 765 | entry_mode: EntryKind::Blob.into(), |
| 720 | oid: hex_to_id("e69de29bb2d1d6434b8b29ae775ad8c2e48c5391"), | 766 | oid: empty_blob_id, |
| 721 | path: "gix-sec/2".into(), | 767 | path: "gix-sec/2".into(), |
| 722 | relation: Some(Relation::ChildOfParent(2)), | 768 | relation: Some(Relation::ChildOfParent(2)), |
| 723 | }, | 769 | }, |
| 724 | Addition { | 770 | Addition { |
| 725 | entry_mode: EntryKind::Blob.into(), | 771 | entry_mode: EntryKind::Blob.into(), |
| 726 | oid: hex_to_id("e69de29bb2d1d6434b8b29ae775ad8c2e48c5391"), | 772 | oid: empty_blob_id, |
| 727 | path: "gix-sec/7".into(), | 773 | path: "gix-sec/7".into(), |
| 728 | relation: Some(Relation::ChildOfParent(2)), | 774 | relation: Some(Relation::ChildOfParent(2)), |
| 729 | }, | 775 | }, |
| 730 | Addition { | 776 | Addition { |
| 731 | entry_mode: EntryKind::Tree.into(), | 777 | entry_mode: EntryKind::Tree.into(), |
| 732 | oid: hex_to_id("fd7938a0c18f993c89eda3f40a6d06fa6785833c"), | 778 | oid: hex_to_id( |
| | 779 | "fd7938a0c18f993c89eda3f40a6d06fa6785833c", |
| | 780 | "5b2e08d098c63c2f31c8937c810f77ff005c48833701e0854f690188f1887aae" |
| | 781 | ), |
| 733 | path: "gix-sec/subdir".into(), | 782 | path: "gix-sec/subdir".into(), |
| 734 | relation: Some(Relation::ChildOfParent(2)), | 783 | relation: Some(Relation::ChildOfParent(2)), |
| 735 | }, | 784 | }, |
| 736 | Deletion { | 785 | Deletion { |
| 737 | entry_mode: EntryKind::Blob.into(), | 786 | entry_mode: EntryKind::Blob.into(), |
| 738 | oid: hex_to_id("e69de29bb2d1d6434b8b29ae775ad8c2e48c5391"), | 787 | oid: empty_blob_id, |
| 739 | path: "git-sec/subdir/6".into(), | 788 | path: "git-sec/subdir/6".into(), |
| 740 | relation: Some(Relation::ChildOfParent(1)), | 789 | relation: Some(Relation::ChildOfParent(1)), |
| 741 | }, | 790 | }, |
| 742 | Addition { | 791 | Addition { |
| 743 | entry_mode: EntryKind::Blob.into(), | 792 | entry_mode: EntryKind::Blob.into(), |
| 744 | oid: hex_to_id("e69de29bb2d1d6434b8b29ae775ad8c2e48c5391"), | 793 | oid: empty_blob_id, |
| 745 | path: "gix-sec/subdir/6".into(), | 794 | path: "gix-sec/subdir/6".into(), |
| 746 | relation: Some(Relation::ChildOfParent(2)), | 795 | relation: Some(Relation::ChildOfParent(2)), |
| 747 | } | 796 | } |
| @@ -754,67 +803,83 @@ mod changes { · 6 unmodified lines |
| 754 | fn reverse_directory_rename() -> crate::Result { | 803 | fn reverse_directory_rename() -> crate::Result { |
| 755 | let db = db(None)?; | 804 | let db = db(None)?; |
| 756 | let all_commits = all_commits(&db); | 805 | let all_commits = all_commits(&db); |
| | 806 | let empty_blob_id = hex_to_id( |
| | 807 | "e69de29bb2d1d6434b8b29ae775ad8c2e48c5391", |
| | 808 | "473a0f4c3be8a93681a267e3b1e9a7dcda1185436fe141f7749120a303721813", |
| | 809 | ); |
| 757 | | 810 | |
| 758 | assert_hash_agnostic_eq!( | 811 | pretty_assertions::assert_eq!( |
| 759 | diff_with_previous_commit_from(&db, &all_commits["rename gix-sec to git-sec"])?, | 812 | diff_with_previous_commit_from(&db, &all_commits["rename gix-sec to git-sec"])?, |
| 760 | vec![ | 813 | vec![ |
| 761 | Addition { | 814 | Addition { |
| 762 | entry_mode: EntryKind::Tree.into(), | 815 | entry_mode: EntryKind::Tree.into(), |
| 763 | oid: hex_to_id("d8c30fb72173778ed57fac5813c5e37038a8746c"), | 816 | oid: hex_to_id( |
| | 817 | "d8c30fb72173778ed57fac5813c5e37038a8746c", |
| | 818 | "52a70042eff6fbeed1d6c8c0ed2f9cc775a19cc51b395429c4210bc5091520ad" |
| | 819 | ), |
| 764 | path: "git-sec".into(), | 820 | path: "git-sec".into(), |
| 765 | relation: Some(Relation::Parent(1)), | 821 | relation: Some(Relation::Parent(1)), |
| 766 | }, | 822 | }, |
| 767 | Deletion { | 823 | Deletion { |
| 768 | entry_mode: EntryKind::Tree.into(), | 824 | entry_mode: EntryKind::Tree.into(), |
| 769 | oid: hex_to_id("d8c30fb72173778ed57fac5813c5e37038a8746c"), | 825 | oid: hex_to_id( |
| | 826 | "d8c30fb72173778ed57fac5813c5e37038a8746c", |
| | 827 | "52a70042eff6fbeed1d6c8c0ed2f9cc775a19cc51b395429c4210bc5091520ad" |
| | 828 | ), |
| 770 | path: "gix-sec".into(), | 829 | path: "gix-sec".into(), |
| 771 | relation: Some(Relation::Parent(2)), | 830 | relation: Some(Relation::Parent(2)), |
| 772 | }, | 831 | }, |
| 773 | Addition { | 832 | Addition { |
| 774 | entry_mode: EntryKind::Blob.into(), | 833 | entry_mode: EntryKind::Blob.into(), |
| 775 | oid: hex_to_id("e69de29bb2d1d6434b8b29ae775ad8c2e48c5391"), | 834 | oid: empty_blob_id, |
| 776 | path: "git-sec/2".into(), | 835 | path: "git-sec/2".into(), |
| 777 | relation: Some(Relation::ChildOfParent(1)), | 836 | relation: Some(Relation::ChildOfParent(1)), |
| 778 | }, | 837 | }, |
| 779 | Addition { | 838 | Addition { |
| 780 | entry_mode: EntryKind::Blob.into(), | 839 | entry_mode: EntryKind::Blob.into(), |
| 781 | oid: hex_to_id("e69de29bb2d1d6434b8b29ae775ad8c2e48c5391"), | 840 | oid: empty_blob_id, |
| 782 | path: "git-sec/7".into(), | 841 | path: "git-sec/7".into(), |
| 783 | relation: Some(Relation::ChildOfParent(1)), | 842 | relation: Some(Relation::ChildOfParent(1)), |
| 784 | }, | 843 | }, |
| 785 | Addition { | 844 | Addition { |
| 786 | entry_mode: EntryKind::Tree.into(), | 845 | entry_mode: EntryKind::Tree.into(), |
| 787 | oid: hex_to_id("fd7938a0c18f993c89eda3f40a6d06fa6785833c"), | 846 | oid: hex_to_id( |
| | 847 | "fd7938a0c18f993c89eda3f40a6d06fa6785833c", |
| | 848 | "5b2e08d098c63c2f31c8937c810f77ff005c48833701e0854f690188f1887aae" |
| | 849 | ), |
| 788 | path: "git-sec/subdir".into(), | 850 | path: "git-sec/subdir".into(), |
| 789 | relation: Some(Relation::ChildOfParent(1)), | 851 | relation: Some(Relation::ChildOfParent(1)), |
| 790 | }, | 852 | }, |
| 791 | Deletion { | 853 | Deletion { |
| 792 | entry_mode: EntryKind::Blob.into(), | 854 | entry_mode: EntryKind::Blob.into(), |
| 793 | oid: hex_to_id("e69de29bb2d1d6434b8b29ae775ad8c2e48c5391"), | 855 | oid: empty_blob_id, |
| 794 | path: "gix-sec/2".into(), | 856 | path: "gix-sec/2".into(), |
| 795 | relation: Some(Relation::ChildOfParent(2)), | 857 | relation: Some(Relation::ChildOfParent(2)), |
| 796 | }, | 858 | }, |
| 797 | Deletion { | 859 | Deletion { |
| 798 | entry_mode: EntryKind::Blob.into(), | 860 | entry_mode: EntryKind::Blob.into(), |
| 799 | oid: hex_to_id("e69de29bb2d1d6434b8b29ae775ad8c2e48c5391"), | 861 | oid: empty_blob_id, |
| 800 | path: "gix-sec/7".into(), | 862 | path: "gix-sec/7".into(), |
| 801 | relation: Some(Relation::ChildOfParent(2)), | 863 | relation: Some(Relation::ChildOfParent(2)), |
| 802 | }, | 864 | }, |
| 803 | Deletion { | 865 | Deletion { |
| 804 | entry_mode: EntryKind::Tree.into(), | 866 | entry_mode: EntryKind::Tree.into(), |
| 805 | oid: hex_to_id("fd7938a0c18f993c89eda3f40a6d06fa6785833c"), | 867 | oid: hex_to_id( |
| | 868 | "fd7938a0c18f993c89eda3f40a6d06fa6785833c", |
| | 869 | "5b2e08d098c63c2f31c8937c810f77ff005c48833701e0854f690188f1887aae" |
| | 870 | ), |
| 806 | path: "gix-sec/subdir".into(), | 871 | path: "gix-sec/subdir".into(), |
| 807 | relation: Some(Relation::ChildOfParent(2)), | 872 | relation: Some(Relation::ChildOfParent(2)), |
| 808 | }, | 873 | }, |
| 809 | Addition { | 874 | Addition { |
| 810 | entry_mode: EntryKind::Blob.into(), | 875 | entry_mode: EntryKind::Blob.into(), |
| 811 | oid: hex_to_id("e69de29bb2d1d6434b8b29ae775ad8c2e48c5391"), | 876 | oid: empty_blob_id, |
| 812 | path: "git-sec/subdir/6".into(), | 877 | path: "git-sec/subdir/6".into(), |
| 813 | relation: Some(Relation::ChildOfParent(1)), | 878 | relation: Some(Relation::ChildOfParent(1)), |
| 814 | }, | 879 | }, |
| 815 | Deletion { | 880 | Deletion { |
| 816 | entry_mode: EntryKind::Blob.into(), | 881 | entry_mode: EntryKind::Blob.into(), |
| 817 | oid: hex_to_id("e69de29bb2d1d6434b8b29ae775ad8c2e48c5391"), | 882 | oid: empty_blob_id, |
| 818 | path: "gix-sec/subdir/6".into(), | 883 | path: "gix-sec/subdir/6".into(), |
| 819 | relation: Some(Relation::ChildOfParent(2)), | 884 | relation: Some(Relation::ChildOfParent(2)), |
| 820 | } | 885 | } |