CB-9B: journal `reference-transaction` evidence from Git's actual wire format (review blocker 5): the transaction state arrives as `argv[1]` and stdin carries ` ` lines. This is authoritative evidence only that a *committed* ref transaction moved a ref (RFC §5.4); it is never rewrite identity and never triggers import or reconciliation. `preparing`, `prepared`, and `a
(root: &Path, state: &str)
| 1107 | /// are journal evidence that a transaction ran, but they are NOT proof of |
| 1108 | /// movement. |
| 1109 | pub(crate) fn record_reference_transaction(root: &Path, state: &str) -> CliResult<()> { |
| 1110 | let root = canonical_root(root)?; |
| 1111 | let state = state.to_ascii_lowercase(); |
| 1112 | // Git ≥2.55 invokes the hook with four states: `preparing` and |
| 1113 | // `prepared` (a transaction is staged), `committed` (it landed), and |
| 1114 | // `aborted` (it failed). Only `committed` proves movement. |
| 1115 | if !matches!( |
| 1116 | state.as_str(), |
| 1117 | "committed" | "prepared" | "preparing" | "aborted" |
| 1118 | ) { |
| 1119 | return Err(git_error(format!( |
| 1120 | "reference-transaction state must be committed|preparing|prepared|aborted, got '{state}'" |
| 1121 | ))); |
| 1122 | } |
| 1123 | let mut stdin = io::stdin().lock(); |
| 1124 | let mut input = String::new(); |
| 1125 | stdin |
| 1126 | .read_to_string(&mut input) |
| 1127 | .map_err(|error| git_error(format!("cannot read reference-transaction input: {error}")))?; |
| 1128 | drop(stdin); |
| 1129 | |
| 1130 | let transactions = reference_transaction_entries(&input)?; |
| 1131 | |
| 1132 | if transactions.is_empty() { |
| 1133 | return Ok(()); |
| 1134 | } |
| 1135 | |
| 1136 | let event = RefTransactionEventEvidence { |
| 1137 | version: EVENT_VERSION, |
| 1138 | record_type: "reference-transaction", |
| 1139 | event_id: Uuid::new_v4().to_string(), |
| 1140 | recorded_at: Utc::now().to_rfc3339(), |
| 1141 | advisory: true, |
| 1142 | worktree_root: root.clone(), |
| 1143 | interpretation: if state == "committed" { |
| 1144 | REF_INTERPRETATION_COMMITTED |
| 1145 | } else { |
| 1146 | REF_INTERPRETATION_NOT_MOVED |
| 1147 | }, |
| 1148 | state, |
| 1149 | transactions, |
| 1150 | }; |
| 1151 | append_journal_record(&root, &event) |
| 1152 | } |
| 1153 | |
| 1154 | /// Parse reference-transaction stdin lines into recorded movements. |
| 1155 | /// |
no test coverage detected