| @@ -144,9 +144,7 @@ pub(crate) fn prepare( · 143 unmodified lines |
| 144 | checkout_allowed: repo.workdir().is_some(), | 144 | checkout_allowed: repo.workdir().is_some(), |
| 145 | expected_refs, | 145 | expected_refs, |
| 146 | }; | 146 | }; |
| 147 | let mut document = b"<!-- Rebase help is at the bottom of this file. -->\n".to_vec(); | 147 | let mut document = b"<!-- Rebase help follows the editable todo. -->\n".to_vec(); |
| 148 | write_state(&mut document, &state); | | |
| 149 | document.push(b'\n'); | | |
| 150 | document.extend_from_slice(title.as_bytes()); | 148 | document.extend_from_slice(title.as_bytes()); |
| 151 | document.extend_from_slice(b"\n\n"); | 149 | document.extend_from_slice(b"\n\n"); |
| 152 | let anchor_kind = if base == onto { | 150 | let anchor_kind = if base == onto { |
| @@ -186,6 +184,7 @@ pub(crate) fn prepare( · 33 unmodified lines |
| 186 | write_fork_heading(&mut document, repo, onto, Some((anchor_kind, anchor_title.as_str())))?; | 184 | write_fork_heading(&mut document, repo, onto, Some((anchor_kind, anchor_title.as_str())))?; |
| 187 | } | 185 | } |
| 188 | document.extend_from_slice(HELP.as_bytes()); | 186 | document.extend_from_slice(HELP.as_bytes()); |
| | 187 | write_state(&mut document, &state); |
| 189 | Ok(Prepared { | 188 | Ok(Prepared { |
| 190 | document, | 189 | document, |
| 191 | apply_unchanged, | 190 | apply_unchanged, |
| @@ -698,7 +697,7 @@ mod tests { · 506 unmodified lines |
| 698 | let prepared = prepare_test(&repo, base, base, &commits, Some(tip))?; | 697 | let prepared = prepare_test(&repo, base, base, &commits, Some(tip))?; |
| 699 | assert!(!prepared.apply_unchanged); | 698 | assert!(!prepared.apply_unchanged); |
| 700 | let document = String::from_utf8(prepared.document.clone())?; | 699 | let document = String::from_utf8(prepared.document.clone())?; |
| 701 | assert!(document.starts_with("<!-- Rebase help is at the bottom of this file. -->")); | 700 | assert!(document.starts_with("<!-- Rebase help follows the editable todo. -->")); |
| 702 | assert!(document.contains(STATE_START), "the todo carries its transaction state"); | 701 | assert!(document.contains(STATE_START), "the todo carries its transaction state"); |
| 703 | assert!(document.contains(&format!("# Rebase from `{}`", base.to_hex_with_len(7)))); | 702 | assert!(document.contains(&format!("# Rebase from `{}`", base.to_hex_with_len(7)))); |
| 704 | assert!(document.contains(&format!("## fork {} (base) base", base.to_hex_with_len(7)))); | 703 | assert!(document.contains(&format!("## fork {} (base) base", base.to_hex_with_len(7)))); |
| @@ -713,7 +712,12 @@ mod tests { · 8 unmodified lines |
| 713 | document.find("# Rebase todo help").expect("help is present") > tip, | 712 | document.find("# Rebase todo help").expect("help is present") > tip, |
| 714 | "complete instructions follow the editable todo" | 713 | "complete instructions follow the editable todo" |
| 715 | ); | 714 | ); |
| 716 | assert!(document.ends_with("-->\n"), "all trailing help is one Markdown comment"); | 715 | assert!( |
| | 716 | document.find(STATE_START).expect("state is present") |
| | 717 | > document.find("# Rebase todo help").expect("help is present"), |
| | 718 | "transaction state follows the complete help" |
| | 719 | ); |
| | 720 | assert!(document.ends_with("-->\n"), "the trailing state is a Markdown comment"); |
| 717 | assert!( | 721 | assert!( |
| 718 | document.contains("○"), | 722 | document.contains("○"), |
| 719 | "unsigned commits carry the documented status symbol" | 723 | "unsigned commits carry the documented status symbol" |