unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: Dmitry Gutov <dmitry@gutov.dev>
Cc: 65763@debbugs.gnu.org, pogonyshev@gmail.com
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	[thread overview]
Message-ID: <83jzt31ez5.fsf@gnu.org> (raw)
In-Reply-To: <7fa60b9c-ae00-5fdd-4805-aa55cb4094e3@gutov.dev> (message from Dmitry Gutov on Wed, 6 Sep 2023 17:31:05 +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	other threads:[~2023-09-06 15:46 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-05 18:54 bug#65763: Error opening a file from a Git working directory if Git is not installed Paul Pogonyshev
2023-09-05 19:44 ` Eli Zaretskii
2023-09-05 20:06   ` Paul Pogonyshev
2023-09-05 20:14     ` Paul Pogonyshev
2023-09-06  2:25       ` Eli Zaretskii
2023-09-06  7:29         ` Paul Pogonyshev
2023-09-06 12:13           ` Eli Zaretskii
2023-09-06 12:35             ` Dmitry Gutov
2023-09-06 12:49               ` Paul Pogonyshev
2023-09-06 12:52                 ` Dmitry Gutov
2023-09-06 13:11                   ` Paul Pogonyshev
2023-09-06 14:31                     ` Dmitry Gutov
2023-09-06 15:46                       ` Eli Zaretskii [this message]
2023-09-06 15:59                         ` Dmitry Gutov
2023-09-10  6:26                           ` Eli Zaretskii
2023-09-10 13:21                             ` Dmitry Gutov
2023-09-10 13:40                               ` Eli Zaretskii
2023-09-10 17:36                                 ` Paul Pogonyshev
2023-09-10 17:52                                   ` Eli Zaretskii
2023-09-06 13:06               ` Eli Zaretskii

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=83jzt31ez5.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=65763@debbugs.gnu.org \
    --cc=dmitry@gutov.dev \
    --cc=pogonyshev@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).