diff options
| author | Craig Jennings <c@cjennings.net> | 2026-05-26 19:28:05 -0500 |
|---|---|---|
| committer | Craig Jennings <c@cjennings.net> | 2026-05-26 19:28:05 -0500 |
| commit | 269ed3c2b1a94ed8ebad5fdce110efb671aa70f6 (patch) | |
| tree | bc954739ec3437b9938ecb7f8cd3d70627de093d /tests | |
| parent | 80eca723d4340d0d67a709e6aef01acb935c706b (diff) | |
| download | pearl-269ed3c2b1a94ed8ebad5fdce110efb671aa70f6.tar.gz pearl-269ed3c2b1a94ed8ebad5fdce110efb671aa70f6.zip | |
fix(refresh): merge keeps any locally-edited ticket
The merge refresh protected a subtree from being overwritten only when its description body had changed, since pearl--subtree-dirty-p is description-only. A local edit to the title, state, priority, assignee, labels, or a comment looked untouched and got re-rendered away. I added pearl--subtree-has-local-edits-p, which wraps the comprehensive per-field detector the save path already uses, and pointed both merge protection sites at it. A merge now keeps any ticket you've touched in any field. The same gain flows to pearl-refresh-current-view.
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/test-pearl-merge.el | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/tests/test-pearl-merge.el b/tests/test-pearl-merge.el index 7cb2a34..122e5fa 100644 --- a/tests/test-pearl-merge.el +++ b/tests/test-pearl-merge.el @@ -142,6 +142,23 @@ (goto-char (point-min)) (should-not (re-search-forward "Alpha Renamed" nil t))))) +(ert-deftest test-pearl-merge-keeps-title-edited-issue () + "A subtree with an unpushed title edit (not a description edit) is kept too. +Merge must protect any locally-edited field, not only the description." + (test-pearl-merge--in-org + (test-pearl-merge--buffer (test-pearl-merge--issue "a" "Alpha" "Desc Alpha.")) + (goto-char (point-min)) + (re-search-forward "Alpha") ; the title word in the heading + (insert " EDITED") ; dirty the title only; body untouched + (let ((counts (pearl--merge-issues-into-buffer + (list (test-pearl-merge--issue "a" "Alpha Renamed" "Remote desc."))))) + (should (= 1 (plist-get counts :skipped))) + (should (= 0 (plist-get counts :updated))) + (goto-char (point-min)) + (should (re-search-forward "Alpha EDITED" nil t)) ; local title edit kept + (goto-char (point-min)) + (should-not (re-search-forward "Alpha Renamed" nil t))))) ; remote did not land + (ert-deftest test-pearl-merge-keeps-dirty-issue-absent-from-result () "A dirty issue gone from the result is kept rather than dropped (no data loss)." (test-pearl-merge--in-org |
