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

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

bug#65763: Error opening a file from a Git working directory if Git is n


From: Eli Zaretskii
Subject: bug#65763: Error opening a file from a Git working directory if Git is not installed
Date: Wed, 06 Sep 2023 18:46:54 +0300

> Date: Wed, 6 Sep 2023 17:31:05 +0300
> Cc: Eli Zaretskii <eliz@gnu.org>, 65763@debbugs.gnu.org
> From: Dmitry Gutov <dmitry@gutov.dev>
> 
> 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).

I prefer to emit the messages, just make them more user-friendly
("searching for program" "no such file or directory" is not very
friendly, IMO), and suppress the error signaling even when
debug-on-error is non-nil.  The reason is simple: we are talking only
about Git not being installed or accessible here, but the problems
could be different and more obscure: Git could be present but
inoperable for some weird misconfiguration reason, or some other
problem could happen.  So "if it is not installed, just silently don't
do anything" is not a complete solution, and the "silently" part loses
information which users may wish to have presented to them.





reply via email to

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