Subject: Re: bug#59414: 29.0.50; Have vc-git-expanded-log-entry pass --stat

From: Eli Zaretskii <[email-masked]>
Date: Mon, 05 Dec 2022 14:29:01 +0200

> From: Sean Whitton <[email-masked]>
> Date: Sun, 04 Dec 2022 15:57:52 -0700
> 
> @@ -1340,16 +1348,16 @@ vc-git-print-log
>  
>  (defun vc-git-log-outgoing (buffer remote-location)
>    (vc-setup-buffer buffer)
> -  (vc-git-command
> -   buffer 'async nil
> -   "log"
> -   "--no-color" "--graph" "--decorate" "--date=short"
> -   (format "--pretty=tformat:%s" (car vc-git-root-log-format))
> -   "--abbrev-commit"
> -   (concat (if (string= remote-location "")
> -	       "@{upstream}"
> -	     remote-location)
> -	   "..HEAD")))
> +  (apply #'vc-git-command buffer 'async nil
> +         `("log"
> +           "--no-color" "--graph" "--decorate" "--date=short"
> +           ,(format "--pretty=tformat:%s" (car vc-git-root-log-format))
> +           "--abbrev-commit"
> +           ,@(ensure-list vc-git-shortlog-switches)
> +           ,(concat (if (string= remote-location "")
> +	                "@{upstream}"
> +	              remote-location)
> +	            "..HEAD"))))

Why the change from vc-git-command to 'apply'?  The former took care for
setting up the I/O encoding for the Git command, while the latter just uses
the process defaults, which are not necessarily right for the underlying
system and locale.

In general, I'd prefer that invocations of all the Git commands went through
a single function, so that we could make sure the encoding/decoding stuff,
which is entirely non-trivial with Git, is done correctly in a single place
that is easy to audit and maintain.  I know that not all the commands are
invoked through there, but making more of them do so is going in the
direction that is 180° opposite to what we should strive to.

Thanks.