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)
| 1076 | /// are journal evidence that a transaction ran, but they are NOT proof of |
| 1077 | /// movement. |
| 1078 | pub(crate) fn record_reference_transaction(root: &Path, state: &str) -> CliResult<()> { |
| 1079 | let root = canonical_root(root)?; |
| 1080 | let state = state.to_ascii_lowercase(); |
| 1081 | // Git ≥2.55 invokes the hook with four states: `preparing` and |
| 1082 | // `prepared` (a transaction is staged), `committed` (it landed), and |
| 1083 | // `aborted` (it failed). Only `committed` proves movement. |
| 1084 | if !matches!( |
| 1085 | state.as_str(), |
| 1086 | "committed" | "prepared" | "preparing" | "aborted" |
| 1087 | ) { |
| 1088 | return Err(git_error(format!( |
| 1089 | "reference-transaction state must be committed|preparing|prepared|aborted, got '{state}'" |
| 1090 | ))); |
| 1091 | } |
| 1092 | let mut stdin = io::stdin().lock(); |
| 1093 | let mut input = String::new(); |
| 1094 | stdin |
| 1095 | .read_to_string(&mut input) |
| 1096 | .map_err(|error| git_error(format!("cannot read reference-transaction input: {error}")))?; |
| 1097 | drop(stdin); |
| 1098 | |
| 1099 | let transactions = reference_transaction_entries(&input)?; |
| 1100 | |
| 1101 | if transactions.is_empty() { |
| 1102 | return Ok(()); |
| 1103 | } |
| 1104 | |
| 1105 | let event = RefTransactionEventEvidence { |
| 1106 | version: EVENT_VERSION, |
| 1107 | record_type: "reference-transaction", |
| 1108 | event_id: Uuid::new_v4().to_string(), |
| 1109 | recorded_at: Utc::now().to_rfc3339(), |
| 1110 | advisory: true, |
| 1111 | worktree_root: root.clone(), |
| 1112 | interpretation: if state == "committed" { |
| 1113 | REF_INTERPRETATION_COMMITTED |
| 1114 | } else { |
| 1115 | REF_INTERPRETATION_NOT_MOVED |
| 1116 | }, |
| 1117 | state, |
| 1118 | transactions, |
| 1119 | }; |
| 1120 | append_journal_record(&root, &event) |
| 1121 | } |
| 1122 | |
| 1123 | /// Parse reference-transaction stdin lines into recorded movements. |
| 1124 | /// |
no test coverage detected