aboutsummaryrefslogtreecommitdiff
path: root/tests/test-reconcile--pull-clean.el
diff options
context:
space:
mode:
authorCraig Jennings <c@cjennings.net>2026-05-10 02:44:10 -0500
committerCraig Jennings <c@cjennings.net>2026-05-10 02:44:10 -0500
commitee356606ee5bc603a86df3417b0740ed3d386199 (patch)
tree8c4bb709f1f92cbdc13e15c78a3ee4d0a75219d6 /tests/test-reconcile--pull-clean.el
parent5150813e940f3eaef26b30a9c130da5ae4a3d95a (diff)
downloaddotemacs-ee356606ee5bc603a86df3417b0740ed3d386199.tar.gz
dotemacs-ee356606ee5bc603a86df3417b0740ed3d386199.zip
Make repo reconciliation review-first
Stop automatically stashing, pulling, and popping dirty repos during reconciliation. Clean repos still pull, dirty repos open Magit for review, and results now include structured statuses, skip reasons, pruning, and a summary.
Diffstat (limited to 'tests/test-reconcile--pull-clean.el')
-rw-r--r--tests/test-reconcile--pull-clean.el32
1 files changed, 17 insertions, 15 deletions
diff --git a/tests/test-reconcile--pull-clean.el b/tests/test-reconcile--pull-clean.el
index a10c6f1e..89739987 100644
--- a/tests/test-reconcile--pull-clean.el
+++ b/tests/test-reconcile--pull-clean.el
@@ -17,12 +17,14 @@
("repo/.git/")
(let ((dir (expand-file-name "repo" test-root))
(messages nil))
- (reconcile-test-with-shell-mocks
- (lambda (_cmd) 0)
- (lambda (_cmd) "")
- (cl-letf (((symbol-function 'message)
+ (reconcile-test-with-git-mock
+ (lambda (args)
+ (should (equal args '("pull" "--rebase" "--quiet")))
+ '(:exit 0 :output ""))
+ (cl-letf (((symbol-function 'message)
(lambda (fmt &rest args) (push (apply #'format fmt args) messages))))
- (cj/reconcile--pull-clean dir)))
+ (let ((result (cj/reconcile--pull-clean dir)))
+ (should (eq (plist-get result :status) 'pulled)))))
(should-not (cl-some (lambda (m) (string-match-p "Warning" m)) messages)))))
(ert-deftest test-pull-clean-normal-failure-warns ()
@@ -31,12 +33,13 @@
("repo/.git/")
(let ((dir (expand-file-name "repo" test-root))
(messages nil))
- (reconcile-test-with-shell-mocks
- (lambda (_cmd) 1)
- (lambda (_cmd) "")
- (cl-letf (((symbol-function 'message)
+ (reconcile-test-with-git-mock
+ (lambda (_args) '(:exit 1 :output "boom\n"))
+ (cl-letf (((symbol-function 'message)
(lambda (fmt &rest args) (push (apply #'format fmt args) messages))))
- (cj/reconcile--pull-clean dir)))
+ (let ((result (cj/reconcile--pull-clean dir)))
+ (should (eq (plist-get result :status) 'pull-failed))
+ (should (equal (plist-get result :output) "boom\n")))))
(should (cl-some (lambda (m) (string-match-p "Warning.*git pull failed" m)) messages))
(should (cl-some (lambda (m) (string-match-p "exit code: 1" m)) messages)))))
@@ -48,12 +51,11 @@
("repo/.git/")
(let ((dir (expand-file-name "repo" test-root))
(messages nil))
- (reconcile-test-with-shell-mocks
- (lambda (_cmd) 128)
- (lambda (_cmd) "")
- (cl-letf (((symbol-function 'message)
+ (reconcile-test-with-git-mock
+ (lambda (_args) '(:exit 128 :output "fatal\n"))
+ (cl-letf (((symbol-function 'message)
(lambda (fmt &rest args) (push (apply #'format fmt args) messages))))
- (cj/reconcile--pull-clean dir)))
+ (cj/reconcile--pull-clean dir)))
(should (cl-some (lambda (m) (string-match-p "exit code: 128" m)) messages)))))
(provide 'test-reconcile--pull-clean)