From b1ac9c0162bdb918163d34da533d2af52482284c Mon Sep 17 00:00:00 2001 From: Saba Saba Date: Thu, 9 Feb 2023 12:26:20 -0500 Subject: [PATCH] Fixed defect with single string case for handle-file-paths --- git-repl.cl | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/git-repl.cl b/git-repl.cl index 5124325..4ecca4c 100644 --- a/git-repl.cl +++ b/git-repl.cl @@ -87,15 +87,20 @@ collect (ldiff front next) while next)) -(defun handle-file-paths (arg) +(defun-public handle-file-paths (arg) + "Accepts either a string or a list of strings. Returns a list of strings, each one surrounded by \", chunked in lists of length *file-chunk-length*" (typecase arg - (string '(add-quotes arg)) + (string (list (add-quotes arg))) (list (mapcar (lambda (x) (str:join " " x)) (chunk-list *file-chunk-length* (mapcar #'add-quotes arg)))) (t (error "Argument must be either a string or a list of strings.")))) -(defun-public update-index (command file-path) +(defun-public git-chunked-command (command subcommand file-path) "Runs the specified command on the filepath or list of filepaths" - (mapcar (lambda (x) (git "update-index" command "--" x)) (handle-file-paths file-path))) + (mapcar (lambda (x) (git command subcommand "--" x)) (handle-file-paths file-path))) + +(defun-public update-index (command file-path) + "Runs the specified update-index command on the filepath or list of filepaths" + (git-chunked-command "update-index" command file-path)) (defun-public skip-file (file-path) "Given a filepath or list of filepaths, skips the specified files" @@ -162,7 +167,7 @@ (defun-public delete-merged-branches () "Deletes every local branch covered by \'git branch --merged\'" - (mapcar #'delete-branch (git "branch" "--merged"))) + (git-chunked-command "branch" "-d" (git "branch" "--merged"))) (defun-public help () "Prints out usage instructions for this REPL" -- 2.20.1