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

From: Eli Zaretskii <[email-masked]>
Date: Tue, 05 Sep 2023 22:44:34 +0300

> From: Paul Pogonyshev <[email-masked]>
> Date: Tue, 5 Sep 2023 20:54:54 +0200
> 
> To reproduce:
> 
> 1. Change current directory to a Git checkout (e.g. `~/git/emacs' or something).
> 2. From the command line:
> 
>        $ emacs --batch --eval "(progn (setf vc-git-program \"git-is-not-installed\") (find-file-noselect
> \"whatever\"))"
>        Error: (file-missing "Searching for program" "No such file or directory" "git-is-not-installed")
> 
> Expected: Emacs is able to open the file, Git must not be essential.

Emacs does open the file; what you see is not an error, it's a
message.  The code which tries to invoke Git runs with-demoted-errors,
so any error is converted to a simple message.  If you try this
variant of your command:

  $ emacs --batch --eval "(progn (setf vc-git-program \"git-is-not-installed\") (message \"%s\" (find-file-noselect \"README\")))"

you will see:

  Error: (file-missing "Searching for program" "No such file or directory" "git-is-not-installed")
  README

That "README" at the end means that find-file-noselect did read the
file into its buffer, and the error message is just a message.

So if this somehow prevented you from doing something, please tell
more, or maybe the recipe needs more steps?