From mboxrd@z Thu Jan 1 00:00:00 1970 From: Carsten Dominik Subject: Re: [PATCH] Org attach: use vc to find the git dir if it exists Date: Sat, 31 Aug 2013 15:58:36 +0200 Message-ID: <80F28573-BB41-43C0-B0D8-9F7EAD39A197@gmail.com> References: <87txiv2g3t.dlv@gobelin.at.home> Mime-Version: 1.0 (Mac OS X Mail 6.5 \(1508\)) Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:53857) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VFlhR-0001u1-Ay for emacs-orgmode@gnu.org; Sat, 31 Aug 2013 09:58:57 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VFlhI-0004tj-QZ for emacs-orgmode@gnu.org; Sat, 31 Aug 2013 09:58:49 -0400 Received: from mail-ea0-x236.google.com ([2a00:1450:4013:c01::236]:55617) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VFlhI-0004tf-J7 for emacs-orgmode@gnu.org; Sat, 31 Aug 2013 09:58:40 -0400 Received: by mail-ea0-f182.google.com with SMTP id o10so1457321eaj.27 for ; Sat, 31 Aug 2013 06:58:39 -0700 (PDT) In-Reply-To: <87txiv2g3t.dlv@gobelin.at.home> 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: =?iso-8859-1?Q?R=E9mi_Vanicat?= Cc: emacs-orgmode@gnu.org Applied, thank you Remi. - Carsten On 12.8.2013, at 15:28, R=E9mi Vanicat wrote: > 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.=20 >=20 > 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. >=20 > --- > lisp/org-attach.el | 9 +++++---- > 1 file changed, 5 insertions(+), 4 deletions(-) >=20 > 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 > --=20 > 1.8.4.rc2 >=20 >=20 >=20