branch: externals/vc-jj commit db1427ba24d068bb14388021b4802e5a7e8f83bb Author: Rudi Schlatte <r...@constantly.at> Commit: Rudi Schlatte <r...@constantly.at>
Simplify, add tests for vc-ignore --- vc-jj-tests.el | 16 ++++++++++++++++ vc-jj.el | 13 ------------- 2 files changed, 16 insertions(+), 13 deletions(-) diff --git a/vc-jj-tests.el b/vc-jj-tests.el index b836a5d951..e67401899a 100644 --- a/vc-jj-tests.el +++ b/vc-jj-tests.el @@ -137,5 +137,21 @@ is needed." (kill-buffer readme-buffer) (kill-buffer annotation-buffer)))) +(ert-deftest vc-jj-ignore () + (vc-jj-test-with-repo repo + (write-region "xxx" nil "root-ignored.txt") + (make-directory "subdir") + (write-region "xxx" nil "subdir/subdir-ignored.txt") + (should (eq (vc-jj-state "root-ignored.txt") 'added)) + (should (eq (vc-jj-state "subdir/subdir-ignored.txt") 'added)) + (vc-jj-ignore "root-ignored.txt") + (vc-jj-ignore "subdir/subdir-ignored.txt") + (should (eq (vc-jj-state "root-ignored.txt") nil)) + (should (eq (vc-jj-state "subdir/subdir-ignored.txt") nil)) + (vc-jj-ignore "root-ignored.txt" nil t) + (vc-jj-ignore "subdir/subdir-ignored.txt" nil t) + (should (eq (vc-jj-state "root-ignored.txt") 'added)) + (should (eq (vc-jj-state "subdir/subdir-ignored.txt") 'added)))) + (provide 'vc-jj-tests) ;;; vc-jj-tests.el ends here diff --git a/vc-jj.el b/vc-jj.el index 0cb63c688e..9b2d009c4b 100644 --- a/vc-jj.el +++ b/vc-jj.el @@ -344,19 +344,6 @@ Return NIL if FILE is not in a jj repository." (defalias 'vc-jj-responsible-p #'vc-jj-root) -(defun vc-jj-find-ignore-file (file) - "Return the .gitignore file that controls FILE." - (let ((root (vc-jj-root file)) - (ignore (expand-file-name - (locate-dominating-file default-directory - ".gitignore")))) - (expand-file-name - ".gitignore" - (if (string-prefix-p (file-name-as-directory root) - (file-name-as-directory ignore)) - ignore - root)))) - (defun vc-jj-ignore (file &optional directory remove) "Ignore FILE under DIRECTORY.