bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#62735: 30.0.50; project.el project-search errors because project-fil


From: Robert Nikander
Subject: bug#62735: 30.0.50; project.el project-search errors because project-files returns directories
Date: Sun, 9 Apr 2023 17:25:07 -0600

Hi Dmitry,

I don’t think it’s a submodule anymore. The directory does have a .git folder 
in it though (like a submodule). The directory was simply copied into the 
project tree like that, as part of moving it between projects. There is no 
'.gitmodules' file anywhere. So my guess is this bug was being triggered by the 
mere existence of the .git directory nested a few layers down in my project. 
That .git directory is not going to stay there, it’s going to get deleted, but 
of course it still shouldn’t crash the emacs command.

Rob

> On Apr 9, 2023, at 5:15 PM, Dmitry Gutov <dmitry@gutov.dev> wrote:
> 
> Version: 29.1
> 
> Hi!
> 
> On 09/04/2023 00:45, Robert Nikander via Bug reports for GNU Emacs, the Swiss 
> army knife of text editors wrote:
>> Hi,
>> I tried to run the command `project-search`, documented in "29.2.1 Project 
>> Commands That Operate on Files”. It threw an error because it tried to 
>> process a directory. The backtrace from debugger is below.
>> The function defined right below `project-search` in project.el is 
>> `project-query-replace-regexp`. It has this comment and line:
>>     ;; XXX: Filter out Git submodules, which are not regular files.
>>     ;; `project-files' can return those, which is arguably suboptimal,
>>     ;; but removing them eagerly has performance cost.
>>     (cl-delete-if-not #'file-regular-p (project-files (project-current t)))
>> I added the same to `project-search` and it seems to have “fixed” it. I 
>> don’t know how `project-files` works, but probably it would be better to fix 
>> that.
>> This directory “…/SomeDir/“ has a .git directory inside it. That appears to 
>> be why project-files picked it up, because deleting that .git subdir also 
>> avoids the error. But projects should be able to have nested .git 
>> directories, depending on how the ‘project’ is defined.
> 
> Thanks for the report. Am I correct to understand that the directory is a 
> submodule? This is the main case which triggers this problem that I know 
> about.
> 
> I've pushed a similar fix just like you suggested. 'project-search' should be 
> okay now.
> 
> Note that 'project-find-regexp' (bound to 'C-x p g' by default) is usually a 
> more efficient command to use rather than 'project-search' -- faster, works 
> remotely, etc. But it has a very different interface.






reply via email to

[Prev in Thread] Current Thread [Next in Thread]