unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Dmitry Gutov <dgutov@yandex.ru>
To: emacs-devel@gnu.org
Subject: Re: Breakage by commit "779bc886f9 * Improve detection of Git submodules"
Date: Sat, 16 May 2020 00:03:53 +0300	[thread overview]
Message-ID: <ef90266e-f3f1-a1a8-acab-1ecd654264d9@yandex.ru> (raw)
In-Reply-To: <871rnluglr.fsf@gnu.org>

On 15.05.2020 22:45, Tassilo Horn wrote:
> I've edebugged, and the problem is that
> 
> (let ((default-directory "~/Repos/el/emacs/lisp/net"))
>    (vc-root-dir)) ;=> nil
> 
> That's because `vc-deduce-backend' returns nil.  It only looks at
> default-directory when in dired-mode, shell-mode, or compilation-mode...

Oh, okay. Sorry about that.

Does this patch fix the situation?

diff --git a/lisp/progmodes/project.el b/lisp/progmodes/project.el
index faa60d123f..0ce2786a4d 100644
--- a/lisp/progmodes/project.el
+++ b/lisp/progmodes/project.el
@@ -274,8 +274,7 @@ project-try-vc
              ('Git
               ;; Don't stop at submodule boundary.
               (or (vc-file-getprop dir 'project-git-root)
-                 (let* ((default-directory dir)
-                        (root (vc-root-dir))
+                 (let* ((root (vc-call-backend backend 'root dir))
                          (gitfile (expand-file-name ".git" root)))
                     (vc-file-setprop
                      dir 'project-git-root
@@ -287,9 +286,8 @@ project-try-vc
                          (goto-char (point-min))
                          (looking-at "gitdir: [./]+/\.git/modules/"))
                        (let* ((parent (file-name-directory
-                                      (directory-file-name root)))
-                             (default-directory parent))
-                        (vc-root-dir)))
+                                      (directory-file-name root))))
+                        (vc-call-backend backend 'root parent)))
                       (t root)))
                     )))
              ('nil nil)



  reply	other threads:[~2020-05-15 21:03 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-15 19:03 Breakage by commit "779bc886f9 * Improve detection of Git submodules" Tassilo Horn
2020-05-15 19:11 ` Dmitry Gutov
2020-05-15 19:45   ` Tassilo Horn
2020-05-15 21:03     ` Dmitry Gutov [this message]
2020-05-16  7:15       ` Tassilo Horn

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ef90266e-f3f1-a1a8-acab-1ecd654264d9@yandex.ru \
    --to=dgutov@yandex.ru \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.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).