summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorErik Hetzner <egh@e6h.org>2016-02-26 12:44:46 -0800
committerNicolas Goaziou <mail@nicolasgoaziou.fr>2016-04-10 10:13:57 +0200
commitf97317abcb9b3f59dcf6aee413f9f9743a52c150 (patch)
tree58779d1d56e184d8994e4df35821122ab993c1b3
parentd79835a821f24fdc32a0f46630f1b31c58fbbb4a (diff)
downloadorg-mode-f97317abcb9b3f59dcf6aee413f9f9743a52c150.tar.gz
org-attach: Use relative path for git annex
* 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.
-rw-r--r--lisp/org-attach.el33
1 files 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.