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