From c2e83e2033b1ec08c312525e19bc5dd7348d3dad Mon Sep 17 00:00:00 2001 From: Saba Saba Date: Thu, 9 Feb 2023 12:26:23 -0500 Subject: [PATCH] Added skip-file-pattern and no-skip-file-pattern. --- git-repl.cl | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/git-repl.cl b/git-repl.cl index e203ae4..c4b87e2 100644 --- a/git-repl.cl +++ b/git-repl.cl @@ -142,6 +142,21 @@ "Unskips every skipped file" (no-skip-file (skipped-files))) +(defun handle-skip-file-pattern (skip-action files-action pattern predicate) + (funcall skip-action (remove-if-not (lambda (file-name) (funcall predicate pattern file-name)) (funcall files-action)))) + +(defun-public skip-file-pattern (pattern &key (predicate #'str:ends-with-p)) + "Skips every file with the specified pattern in the filename. + By default, the pattern is checked only at the end of the filename. + Use STR:STARTS-WITH-P or STR:CONTAINSP for different behaviour." + (handle-skip-file-pattern #'skip-file #'modified-files pattern predicate)) + +(defun-public no-skip-file-pattern (pattern &key (predicate #'str:ends-with-p)) + "Unskips every file with the specified pattern in the filename. + By default, the pattern is checked only at the end of the filename. + Use STR:STARTS-WITH-P or STR:CONTAINSP for different behaviour." + (handle-skip-file-pattern #'no-skip-file #'skipped-files pattern predicate)) + (defun-public save-stash () "Stashes every modified file" (git "stash")) -- 2.20.1