Subject: Re: bug#65763: Error opening a file from a Git working directory if Git is not installed

From: Dmitry Gutov <[email-masked]>
Date: Wed, 6 Sep 2023 17:31:05 +0300

On 06/09/2023 16:11, Paul Pogonyshev wrote:
> Also consider this from a user point of view. Let's say I have nothing 
> to do with programming at all and don't have Git installed. Someone 
> emails me a cool Emacs package as a tarball and accidentally archives 
> `.git' along, because he is a developer. I unpack it, open some file and 
> now my Emacs warns me that Git is not installed. But why? I didn't even 
> ask it to do anything. It /itself/ decided to do something (because it 
> saw a `.git' directory), failed (Git is not installed), and now warns 
> /me/. From my point of view, if there is a failure for action that 
> wasn't direct result of user order, Emacs should stay silent.

There was a previous discussion on this on the bug tracker which I can't 
find now. If someone is more able than me, it would be a welcome help.

I think Lars was involved, and the general argument was that if .git is 
present, the user is plausibly interested in using our VC features and 
might not understand which programs might be needed to be installed for 
that to work. Or just forget about that aspect e.g. on a new machine. So 
we help them with those warnings.

> In other words, I think there are two sane options here:
> 
> 1) Simply check if Git is installed before doing anything Git-related 
> from `find-file-hook' callback. If it is not installed, just silently 
> don't do anything. Reserve errors and warnings until the user actually 
> ask you to do something Git-related, not simply to open a file.

I don't mind this solution as well, and it has its logic.

So if others like this approach we could do such change (roughly, we'd 
need to capture errors in all 'registered' functions at least, reraise 
as vc-backend-program-missing, and then catch them -- and only them -- 
silently at the top level).