Unified · Split
| @@ -80,8 +80,44 @@ fn reference_with_old_value_must_exist_when_creating_it_and_have_that_value() {} · 79 unmodified lines | ||
| 80 | 80 | fn reference_without_old_value_must_not_exist_already_when_creating_it() {} |
| 81 | 81 | |
| 82 | 82 | #[test] |
| 83 | −#[ignore] | |
| 84 | −fn cancellation_after_preparation_leaves_no_change() {} | |
| 83 | +fn cancellation_after_preparation_leaves_no_change() { | |
| 84 | + let (dir, store) = empty_store().unwrap(); | |
| 85 | + | |
| 86 | + let tx = store.transaction( | |
| 87 | + Some(RefEdit { | |
| 88 | + change: Change::Update { | |
| 89 | + log: LogChange { | |
| 90 | + mode: RefLog::AndReference, | |
| 91 | + force_create_reflog: false, | |
| 92 | + message: Default::default(), | |
| 93 | + }, | |
| 94 | + new: Target::Symbolic("refs/heads/main".try_into().unwrap()), | |
| 95 | + mode: Create::Only, | |
| 96 | + }, | |
| 97 | + name: "HEAD".try_into().unwrap(), | |
| 98 | + deref: false, | |
| 99 | + }), | |
| 100 | + Fail::Immediately, | |
| 101 | + ); | |
| 102 | + | |
| 103 | + assert_eq!( | |
| 104 | + std::fs::read_dir(dir.path()).unwrap().count(), | |
| 105 | + 0, | |
| 106 | + "nothing happens before preparation" | |
| 107 | + ); | |
| 108 | + | |
| 109 | + let tx = tx.prepare().unwrap(); | |
| 110 | + | |
| 111 | + assert_eq!( | |
| 112 | + std::fs::read_dir(dir.path()).unwrap().count(), | |
| 113 | + 1, | |
| 114 | + "the lock file was created" | |
| 115 | + ); | |
| 116 | + | |
| 117 | + drop(tx); | |
| 118 | + | |
| 119 | + assert_eq!(std::fs::read_dir(dir.path()).unwrap().count(), 0, "everything vanished"); | |
| 120 | +} | |
| 85 | 121 | |
| 86 | 122 | #[test] |
| 87 | 123 | fn symbolic_head_missing_referent_then_update_referent() -> crate::Result { |