From mboxrd@z Thu Jan 1 00:00:00 1970 From: =?utf-8?Q?R=C3=A9mi_Vanicat?= Subject: [PATCH] Org attach: use vc to find the git dir if it exists Date: Mon, 12 Aug 2013 15:28:22 +0200 Message-ID: <87txiv2g3t.dlv@gobelin.at.home> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:34106) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V8sAw-0003kz-Dz for emacs-orgmode@gnu.org; Mon, 12 Aug 2013 09:28:53 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1V8sAn-00018j-TS for emacs-orgmode@gnu.org; Mon, 12 Aug 2013 09:28:46 -0400 Received: from plane.gmane.org ([80.91.229.3]:42326) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V8sAn-00018H-MX for emacs-orgmode@gnu.org; Mon, 12 Aug 2013 09:28:37 -0400 Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1V8sAl-00035F-Tg for emacs-orgmode@gnu.org; Mon, 12 Aug 2013 15:28:35 +0200 Received: from 80-83-49-19.wifi.dc13.debconf.org ([80.83.49.19]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Mon, 12 Aug 2013 15:28:35 +0200 Received: from vanicat by 80-83-49-19.wifi.dc13.debconf.org with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Mon, 12 Aug 2013 15:28:35 +0200 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 Org attach use to fail to commit the attached file in git or git annex when the .git repository is not in the data sub-directory. This new code will use vc-git to find the .git file, and from this do what is needed for committing file into git or git annex. --- lisp/org-attach.el | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/lisp/org-attach.el b/lisp/org-attach.el index faefa6b..9bf3cda 100644 --- a/lisp/org-attach.el +++ b/lisp/org-attach.el @@ -261,14 +261,15 @@ the ATTACH_DIR property) their own attachment directory." (defun org-attach-commit () "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)) - (changes 0)) - (when (file-exists-p (expand-file-name ".git" dir)) + (let* ((dir (expand-file-name org-attach-directory)) + (git-dir (vc-git-root dir)) + (changes 0)) + (when git-dir (with-temp-buffer (cd dir) (let ((have-annex (and org-attach-git-annex-cutoff - (file-exists-p (expand-file-name ".git/annex" dir))))) + (file-exists-p (expand-file-name "annex" git-dir))))) (dolist (new-or-modified (split-string (shell-command-to-string -- 1.8.4.rc2