From 7e476db19639a5de4b8754a158844590e8586216 Mon Sep 17 00:00:00 2001 From: Carsten Dominik Date: Wed, 24 Mar 2010 22:17:28 +0100 Subject: [PATCH] Attachments: Remove dependence on xargs Patch by David Maus, who writes: > Attached patch for org-attach-commit in org-attach.el removes the > dependency on the xargs command to remove files in the repository that > were deleted in the attachment directory. > > Simply capture output of git ls-files --deleted -z in a temporary > buffer, get the filenames from there via string-split and call git rm > on each single file. --- lisp/ChangeLog | 2 ++ lisp/org-attach.el | 17 +++++++++++------ 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index ff53cf17c..e26454e95 100755 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,5 +1,7 @@ 2010-03-24 Carsten Dominik + * org-attach.el (org-attach-commit): Remove dependence on xargs. + * org-latex.el (org-export-latex-fontify): Do not mistake table.el borders for strike-through emphasis. diff --git a/lisp/org-attach.el b/lisp/org-attach.el index 0428001b2..61b85c4fa 100644 --- a/lisp/org-attach.el +++ b/lisp/org-attach.el @@ -241,12 +241,17 @@ the ATTACH_DIR property) their own attachment directory." "Commit changes to git if `org-attach-directory' is properly initialized. This checks for the existence of a \".git\" directory in that directory." (let ((dir (expand-file-name org-attach-directory))) - (if (file-exists-p (expand-file-name ".git" dir)) - (shell-command - (concat "(cd " dir "; " - " git add .; " - " git ls-files --deleted -z | xargs -0 git rm; " - " git commit -m 'Synchronized attachments')"))))) + (when (file-exists-p (expand-file-name ".git" dir)) + (with-temp-buffer + (cd dir) + (shell-command "git add .") + (shell-command "git ls-files --deleted -z" t) + (mapc '(lambda (file) + (unless (string= file "") + (shell-command + (concat "git rm \"" file "\"")))) + (split-string (buffer-string) "")) + (shell-command "git commit -m 'Synchronized attachments'"))))) (defun org-attach-tag (&optional off) "Turn the autotag on or (if OFF is set) off." -- 2.11.4.GIT