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
584584 trailer in any source message. Name and email pairs are compared without
585585 mailmap. All folded IDs and mutable refs map to the one resulting commit;
586586 resources owned by a later folded review commit are removed.
587−- The first line points to complete self-documenting help at the bottom. All
588− instructions are enclosed in Markdown comments so only headings and command
589− lines participate in the editable plan.
587+- The first line points to complete self-documenting help after the editable
588+ todo. All instructions are enclosed in Markdown comments so only headings and
589+ command lines participate in the editable plan.
590590 - A versioned Markdown state comment makes the document independently
591591 applicable in a later process. It records full base, target, scope and tip IDs,
592592 checkout requirements, and compare-and-swap state for mutable refs. Ref names
593593 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.
595596 - Pick lines use display-only state symbols documented in the footer: `↻` for a
596597 lazy rebase, `◌` for an invalidated signature awaiting signing, `◐` for an
597598 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
144144 checkout_allowed: repo.workdir().is_some(),
145145 expected_refs,
146146 };
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();
150148 document.extend_from_slice(title.as_bytes());
151149 document.extend_from_slice(b"\n\n");
152150 let anchor_kind = if base == onto {
@@ -186,6 +184,7 @@ pub(crate) fn prepare( · 33 unmodified lines
186184 write_fork_heading(&mut document, repo, onto, Some((anchor_kind, anchor_title.as_str())))?;
187185 }
188186 document.extend_from_slice(HELP.as_bytes());
187+ write_state(&mut document, &state);
189188 Ok(Prepared {
190189 document,
191190 apply_unchanged,
@@ -698,7 +697,7 @@ mod tests { · 506 unmodified lines
698697 let prepared = prepare_test(&repo, base, base, &commits, Some(tip))?;
699698 assert!(!prepared.apply_unchanged);
700699 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. -->"));
702701 assert!(document.contains(STATE_START), "the todo carries its transaction state");
703702 assert!(document.contains(&format!("# Rebase from `{}`", base.to_hex_with_len(7))));
704703 assert!(document.contains(&format!("## fork {} (base) base", base.to_hex_with_len(7))));
@@ -713,7 +712,12 @@ mod tests { · 8 unmodified lines
713712 document.find("# Rebase todo help").expect("help is present") > tip,
714713 "complete instructions follow the editable todo"
715714 );
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");
717721 assert!(
718722 document.contains("○"),
719723 "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