emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* org-attach + git annex not working
@ 2015-05-02 19:59 Erik Hetzner
  2015-05-04  3:41 ` John Wiegley
  2015-05-07 20:10 ` Nicolas Goaziou
  0 siblings, 2 replies; 5+ messages in thread
From: Erik Hetzner @ 2015-05-02 19:59 UTC (permalink / raw)
  To: Org Mode; +Cc: John Wiegley

Hi all,

I am trying to get org-attach to work with git-annex, but there is a
bug that prevents it working.

org-attach checks if there is an annex directory in the results of
(vc-git-root org-attach-directory) in order to decide whether to use
git-annex. But the annex directory is a subdir of the .git dir, and
vc-git-root returns the path to the directory that contains .git, not
the .git path itself, e.g. /foo not /foo/.git

I don’t know if the behavior of vc-git-root has changed, but I don’t
see anything in the emacs git log for vc/vc-git.el and it seems to
have the same behavior in 24 & 25.

The following patch fixes this issue.

diff --git a/lisp/org-attach.el b/lisp/org-attach.el
index 1737ec1..b843d48 100644
--- a/lisp/org-attach.el
+++ b/lisp/org-attach.el
@@ -276,7 +276,7 @@ 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))
-	 (git-dir (vc-git-root dir))
+	 (git-dir (expand-file-name ".git" (vc-git-root dir)))
 	 (changes 0))
     (when (and git-dir (executable-find "git"))
       (with-temp-buffer

--
Sent from my free software system <http://fsf.org/>.

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: org-attach + git annex not working
  2015-05-02 19:59 org-attach + git annex not working Erik Hetzner
@ 2015-05-04  3:41 ` John Wiegley
  2015-05-07 20:10 ` Nicolas Goaziou
  1 sibling, 0 replies; 5+ messages in thread
From: John Wiegley @ 2015-05-04  3:41 UTC (permalink / raw)
  To: emacs-orgmode

>>>>> Erik Hetzner <egh@e6h.org> writes:

> I don’t know if the behavior of vc-git-root has changed, but I don’t see
> anything in the emacs git log for vc/vc-git.el and it seems to have the same
> behavior in 24 & 25.

I hadn't noticed it breaking, but is it possible to make your change a bit
more defensive?  I.e., make sure the string ends in .git if it doesn't
already, rather than always appending .git?

John

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: org-attach + git annex not working
  2015-05-02 19:59 org-attach + git annex not working Erik Hetzner
  2015-05-04  3:41 ` John Wiegley
@ 2015-05-07 20:10 ` Nicolas Goaziou
  2015-05-17  2:10   ` [PATCH] org-attach.el: fix check for git annex Erik Hetzner
  1 sibling, 1 reply; 5+ messages in thread
From: Nicolas Goaziou @ 2015-05-07 20:10 UTC (permalink / raw)
  To: Erik Hetzner; +Cc: John Wiegley, Org Mode

Hello,

Erik Hetzner <egh@e6h.org> writes:

> The following patch fixes this issue.
>
> diff --git a/lisp/org-attach.el b/lisp/org-attach.el
> index 1737ec1..b843d48 100644
> --- a/lisp/org-attach.el
> +++ b/lisp/org-attach.el
> @@ -276,7 +276,7 @@ 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))
> -	 (git-dir (vc-git-root dir))
> +	 (git-dir (expand-file-name ".git" (vc-git-root dir)))
>  	 (changes 0))
>      (when (and git-dir (executable-find "git"))
>        (with-temp-buffer

Thank you.

Could you send it again using git format-patch, with a proper commit
message?


Regards,

-- 
Nicolas Goaziou

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH] org-attach.el: fix check for git annex
  2015-05-07 20:10 ` Nicolas Goaziou
@ 2015-05-17  2:10   ` Erik Hetzner
  2015-05-17  8:25     ` Nicolas Goaziou
  0 siblings, 1 reply; 5+ messages in thread
From: Erik Hetzner @ 2015-05-17  2:10 UTC (permalink / raw)
  To: Org Mode, John Wiegley, Nicolas Goaziou

* lisp/org-attach.el (org-attach-commit): Check for .git/annex dir in
addition to annex dir in root git dir to ensure that git annex is used
---
 lisp/org-attach.el | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/lisp/org-attach.el b/lisp/org-attach.el
index 1737ec1..7f61910 100644
--- a/lisp/org-attach.el
+++ b/lisp/org-attach.el
@@ -283,7 +283,8 @@ This checks for the existence of a \".git\" directory in that directory."
 	(cd dir)
 	(let ((have-annex
 	       (and org-attach-git-annex-cutoff
-		    (file-exists-p (expand-file-name "annex" git-dir)))))
+		    (or (file-exists-p (expand-file-name "annex" git-dir))
+			(file-exists-p (expand-file-name ".git/annex" git-dir))))))
 	  (dolist (new-or-modified
 		   (split-string
 		    (shell-command-to-string
-- 
2.1.4

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] org-attach.el: fix check for git annex
  2015-05-17  2:10   ` [PATCH] org-attach.el: fix check for git annex Erik Hetzner
@ 2015-05-17  8:25     ` Nicolas Goaziou
  0 siblings, 0 replies; 5+ messages in thread
From: Nicolas Goaziou @ 2015-05-17  8:25 UTC (permalink / raw)
  To: Erik Hetzner; +Cc: John Wiegley, Org Mode

Erik Hetzner <egh@e6h.org> writes:

> * lisp/org-attach.el (org-attach-commit): Check for .git/annex dir in
> addition to annex dir in root git dir to ensure that git annex is used

Applied. Thank you.

I added TINYCHANGE at the end of the commit message since you don't
appear to have signed FSF papers. Please correct me if I'm wrong.

Regards,

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2015-05-17  8:24 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-05-02 19:59 org-attach + git annex not working Erik Hetzner
2015-05-04  3:41 ` John Wiegley
2015-05-07 20:10 ` Nicolas Goaziou
2015-05-17  2:10   ` [PATCH] org-attach.el: fix check for git annex Erik Hetzner
2015-05-17  8:25     ` Nicolas Goaziou

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).