Subject: bug#41341: closed (Re: bug#41341: 27.0.91; project.el 0.1.2 project-try-vc() fails in Git subdirectories; patch attached)

From: [email-masked] (GNU bug Tracking System)
Date: Sun, 17 May 2020 12:20:02 +0000

Your bug report

#41341: 27.0.91; project.el 0.1.2 project-try-vc() fails in Git subdirectories; patch attached

which was filed against the emacs package, has been closed.

The explanation is attached below, along with your original report.
If you require more details, please reply to [email-masked].

-- 
41341: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=41341
GNU Bug Tracking System
Contact [email-masked] with problems

Subject: Re: bug#41341: 27.0.91; project.el 0.1.2 project-try-vc() fails in Git subdirectories; patch attached
From: Dmitry Gutov <[email-masked]>
To: [email-masked]
Date: Sun, 17 May 2020 15:19:18 +0300
List-Id: <debbugs-submit.debbugs.gnu.org>

So: closing.

Subject: 27.0.91; project.el 0.1.2 project-try-vc() fails in Git subdirectories; patch attached
From: John SJ Anderson <[email-masked]>
To: [email-masked]
Date: Sat, 16 May 2020 18:51:05 -0700
List-Id: <debbugs-submit.debbugs.gnu.org>

I upgraded packages on 16 May 2020, which resulted in project.el upgrading to v0.1.2. 

I restarted Emacs and got the following stack trace:

Debugger entered--Lisp error: (file-missing "Opening input file" "No such file or directory" "/Users/genehack/proj/apollo/models/.git")
insert-file-contents("/Users/genehack/proj/apollo/models/.git")
project-try-vc("/Users/genehack/proj/apollo/models/")
run-hook-with-args-until-success(project-try-vc "/Users/genehack/proj/apollo/models/")
project--find-in-directory("/Users/genehack/proj/apollo/models/")
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)
find-file-noselect-1(#<buffer index.js> "~/proj/apollo/models/index.js" :nowarn nil "~/proj/apollo/models/index.js" (8667578097 16777222))
  find-file-noselect("/Users/genehack/proj/apollo/models/index.js" :nowarn)
  desktop-restore-file-buffer("/Users/genehack/proj/apollo/models/index.js" "index.js" nil)
  desktop-create-buffer(208 "/Users/genehack/proj/apollo/models/index.js" "index.js" js2-mode (eldoc-mode override-global-mode gcmh-mode global-auto-revert-mode company-mode flymake-mode projectile-mode aggressive-indent-mode flycheck-mode smartparens-mode prettier-js-mode) 1 (nil nil) nil nil ((buffer-display-time 24256 19314 922097 0) (buffer-file-coding-system . undecided-unix)) ((mark-ring nil)))
  eval-buffer(#<buffer  *load*> nil "/Users/genehack/.emacs.d/.emacs.desktop" nil t)  ; Reading at buffer position 9385
  load-with-code-conversion("/Users/genehack/.emacs.d/.emacs.desktop" "/Users/genehack/.emacs.d/.emacs.desktop" t t)
  load("/Users/genehack/.emacs.d/.emacs.desktop" t t t)
  desktop-read()
  #f(compiled-function () #<bytecode 0x1fe27544cc95>)()
  run-hooks(after-init-hook delayed-warnings-hook)
  command-line()
  normal-top-level()

I verified that falling back to project-0.1.el fixed the issue. Looking at the diff between 0.1 and 0.1.2, I was able to concoct the following patch, which seems to resolve the issue:

--- ./upstream-project-0.1.2.el 2020-05-16 13:51:19.000000000 -0700
+++ elpa/project-0.1.2/project.el       2020-05-16 13:50:15.000000000 -0700
@@ -275,7 +275,7 @@
              ;; Don't stop at submodule boundary.
              (or (vc-file-getprop dir 'project-git-root)
                  (let* ((default-directory dir)
-                        (root (vc-root-dir))
+                        (root (vc-find-root dir ".git/"))
                         (gitfile (expand-file-name ".git" root)))
                    (vc-file-setprop
                     dir 'project-git-root

Information generated by `report-emacs-bug` is below: 

In GNU Emacs 27.0.91 (build 1, x86_64-apple-darwin19.3.0, NS appkit-1894.30 Version 10.15.3 (Build 19D76))
 of 2020-04-25 built on phineas.home.genehack.org
Windowing system distributor 'Apple', version 10.3.1894
System Description:  Mac OS X 10.15.4

Configured using:
 'configure --with-gnutls=yes --without-makeinfo --with-ns CPPFLAGS=-I/usr/local/opt/libxml2/include/libxml2 PKG_CONFIG_PATH=/usr/local/lib/pkgconfig'