History

fix: place tix rebase state after todo help

Codex committed 3 months ago

Commit 472d81e1 parent e66aa542 files · +14 −9Browse files

Unified · Split

2 files
  1. gix-tix/spec.md +5 −4
  2. gix-tix/src/edit/todo.rs +9 −5
gix-tix/spec.md+5−4
@@ -584,14 +584,15 @@ space first; changes blocks adapt within the remaining history width. · 583 unmodified lines
584 trailer in any source message. Name and email pairs are compared without584 trailer in any source message. Name and email pairs are compared without
585 mailmap. All folded IDs and mutable refs map to the one resulting commit;585 mailmap. All folded IDs and mutable refs map to the one resulting commit;
586 resources owned by a later folded review commit are removed.586 resources owned by a later folded review commit are removed.
587- The first line points to complete self-documenting help at the bottom. All587- The first line points to complete self-documenting help after the editable
588 instructions are enclosed in Markdown comments so only headings and command588 todo. All instructions are enclosed in Markdown comments so only headings and
589 lines participate in the editable plan.589 command lines participate in the editable plan.
590- A versioned Markdown state comment makes the document independently590- A versioned Markdown state comment makes the document independently
591 applicable in a later process. It records full base, target, scope and tip IDs,591 applicable in a later process. It records full base, target, scope and tip IDs,
592 checkout requirements, and compare-and-swap state for mutable refs. Ref names592 checkout requirements, and compare-and-swap state for mutable refs. Ref names
593 use Git-compatible C-style quoting so arbitrary ref bytes round-trip. Missing593 use Git-compatible C-style quoting so arbitrary ref bytes round-trip. Missing
594 state cancels; present invalid state never reaches repository mutation.594 state cancels; present invalid state never reaches repository mutation. The
595 state comment follows the complete help at the end of the document.
595- Pick lines use display-only state symbols documented in the footer: `↻` for a596- Pick lines use display-only state symbols documented in the footer: `↻` for a
596 lazy rebase, `◌` for an invalidated signature awaiting signing, `◐` for an597 lazy rebase, `◌` for an invalidated signature awaiting signing, `◐` for an
597 unverified signature, and `○` for an unsigned commit. Applicable states may be598 unverified signature, and `○` for an unsigned commit. Applicable states may be
gix-tix/src/edit/todo.rs+9−5
@@ -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"

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t