From mboxrd@z Thu Jan 1 00:00:00 1970 From: Erik Hetzner Subject: [PATCH] org-attach: Use relative path for git annex Date: Fri, 26 Feb 2016 12:44:46 -0800 Message-ID: <56d0bcb0.da10620a.ccd30.1473@mx.google.com> Reply-To: Erik Hetzner Mime-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Content-Type: text/plain; charset=US-ASCII Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:56561) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aZPU6-0008Px-0l for emacs-orgmode@gnu.org; Fri, 26 Feb 2016 15:59:34 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aZPU2-0002wl-M3 for emacs-orgmode@gnu.org; Fri, 26 Feb 2016 15:59:33 -0500 Received: from mail-pf0-x233.google.com ([2607:f8b0:400e:c00::233]:33550) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aZPU2-0002wQ-Ec for emacs-orgmode@gnu.org; Fri, 26 Feb 2016 15:59:30 -0500 Received: by mail-pf0-x233.google.com with SMTP id q63so57721429pfb.0 for ; Fri, 26 Feb 2016 12:59:30 -0800 (PST) List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: emacs-orgmode@gnu.org Cc: David Engster * lisp/org-attach.el (org-attach-annex-get-maybe): Use relative path as argument for git annex. Fixes error in test with version 3 of git annex. --- lisp/org-attach.el | 33 +++++++++++++++++---------------- 1 file changed, 17 insertions(+), 16 deletions(-) diff --git a/lisp/org-attach.el b/lisp/org-attach.el index ebea435..cf8a1ca 100644 --- a/lisp/org-attach.el +++ b/lisp/org-attach.el @@ -299,22 +299,23 @@ the ATTACH_DIR property) their own attachment directory." (defun org-attach-annex-get-maybe (path) "Call git annex get PATH (via shell) if using git annex. Signals an error if the file content is not available and it was not retrieved." - (when (and (org-attach-use-annex) - (not - (string-equal - "found" - (shell-command-to-string - (format "git annex find --format=found --in=here %s" - (shell-quote-argument path)))))) - (let ((should-get - (if (eq org-attach-annex-auto-get 'ask) - (y-or-n-p (format "Run git annex get %s? " path)) - org-attach-annex-auto-get))) - (if should-get - (progn (message "Running git annex get \"%s\"." path) - (call-process "git" nil nil nil "annex" "get" path)) - (error "File %s stored in git annex but it is not available, and was not retrieved" - path))))) + (let ((path-relative (file-relative-name path))) + (when (and (org-attach-use-annex) + (not + (string-equal + "found" + (shell-command-to-string + (format "git annex find --format=found --in=here %s" + (shell-quote-argument path-relative)))))) + (let ((should-get + (if (eq org-attach-annex-auto-get 'ask) + (y-or-n-p (format "Run git annex get %s? " path-relative)) + org-attach-annex-auto-get))) + (if should-get + (progn (message "Running git annex get \"%s\"." path-relative) + (call-process "git" nil nil nil "annex" "get" path-relative)) + (error "File %s stored in git annex but it is not available, and was not retrieved" + path)))))) (defun org-attach-commit () "Commit changes to git if `org-attach-directory' is properly initialized. -- 2.5.0