unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Breakage by commit "779bc886f9 * Improve detection of Git submodules"
@ 2020-05-15 19:03 Tassilo Horn
  2020-05-15 19:11 ` Dmitry Gutov
  0 siblings, 1 reply; 5+ messages in thread
From: Tassilo Horn @ 2020-05-15 19:03 UTC (permalink / raw)
  To: emacs-devel, Dmitry Gutov

Hi Dmitry,

since the commit in the subject, I get errors like the below when
finding a file in a git repository:

--8<---------------cut here---------------start------------->8---
Debugger entered--Lisp error: (file-missing "Opening input file" "No such file or directory" "/home/horn/Repos/el/emacs/lisp/net/.git")
  insert-file-contents(".git")
  project-try-vc("/home/horn/Repos/el/emacs/lisp/net/")
  run-hook-with-args-until-success(project-try-vc "/home/horn/Repos/el/emacs/lisp/net/")
  project--find-in-directory("/home/horn/Repos/el/emacs/lisp/net/")
  project-current()
  eglot--maybe-activate-editing-mode()
  run-hooks(change-major-mode-after-body-hook after-change-major-mode-hook)
  normal-mode(t)
  after-find-file(nil nil t nil nil)
  revert-buffer--default(t nil)
  revert-buffer(t)
  funcall-interactively(revert-buffer t)
  call-interactively(revert-buffer record nil)
  command-execute(revert-buffer record)
--8<---------------cut here---------------end--------------->8---

Bye,
Tassilo



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

* Re: Breakage by commit "779bc886f9 * Improve detection of Git submodules"
  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
  0 siblings, 1 reply; 5+ messages in thread
From: Dmitry Gutov @ 2020-05-15 19:11 UTC (permalink / raw)
  To: emacs-devel

Hi Tassilo,

On 15.05.2020 22:03, Tassilo Horn wrote:
> Hi Dmitry,
> 
> since the commit in the subject, I get errors like the below when
> finding a file in a git repository:

Thanks, should be fixed now.



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

* Re: Breakage by commit "779bc886f9 * Improve detection of Git submodules"
  2020-05-15 19:11 ` Dmitry Gutov
@ 2020-05-15 19:45   ` Tassilo Horn
  2020-05-15 21:03     ` Dmitry Gutov
  0 siblings, 1 reply; 5+ messages in thread
From: Tassilo Horn @ 2020-05-15 19:45 UTC (permalink / raw)
  To: Dmitry Gutov; +Cc: emacs-devel

Dmitry Gutov <dgutov@yandex.ru> writes:

> On 15.05.2020 22:03, Tassilo Horn wrote:
>> Hi Dmitry,
>> since the commit in the subject, I get errors like the below when
>> finding a file in a git repository:
>
> Thanks, should be fixed now.

Nope, sorry.  With emacs -Q evaling

(progn
  (require 'project)
  (project-try-vc "~/Repos/el/emacs/lisp/net"))

gives

Debugger entered--Lisp error: (file-missing "Opening input file" "No such file or directory" "/home/horn/Repos/el/emacs/lisp/net/.git")
  insert-file-contents("/home/horn/Repos/el/emacs/lisp/net/.git")
  project-try-vc("~/Repos/el/emacs/lisp/net")
  (progn (require 'project) (project-try-vc "~/Repos/el/emacs/lisp/net"))

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...
I wonder why that's restricted and not the fallback case...

Bye,
Tassilo



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

* Re: Breakage by commit "779bc886f9 * Improve detection of Git submodules"
  2020-05-15 19:45   ` Tassilo Horn
@ 2020-05-15 21:03     ` Dmitry Gutov
  2020-05-16  7:15       ` Tassilo Horn
  0 siblings, 1 reply; 5+ messages in thread
From: Dmitry Gutov @ 2020-05-15 21:03 UTC (permalink / raw)
  To: emacs-devel

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)



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

* Re: Breakage by commit "779bc886f9 * Improve detection of Git submodules"
  2020-05-15 21:03     ` Dmitry Gutov
@ 2020-05-16  7:15       ` Tassilo Horn
  0 siblings, 0 replies; 5+ messages in thread
From: Tassilo Horn @ 2020-05-16  7:15 UTC (permalink / raw)
  To: Dmitry Gutov; +Cc: emacs-devel

Dmitry Gutov <dgutov@yandex.ru> writes:

> 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?

Yes, that works.  Thanks!

Bye,
Tassilo



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

end of thread, other threads:[~2020-05-16  7:15 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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
2020-05-16  7:15       ` Tassilo Horn

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).