Subject: bug#78987: 30.1; Unable to create new Git repository in Dired mode

From: Juri Linkov <[email-masked]>
Date: Wed, 16 Jul 2025 09:20:01 +0300

>> Do you have an idea how to handle an empty repository on the first commit?
>> Or this needs a separate bug report?
>
> I think this is a bug in vc-git-diff.  Does this fix it:
>
> @@ -1818,7 +1818,10 @@ vc-git-diff
> -      (unless rev1 (setq rev1 "HEAD")))
> +      (unless rev1
> +        (setq rev1 (if (vc-git--empty-db-p)
> +                       "4b825dc642cb6eb9a060e54bf8d69288fbee4904"
> +                     "HEAD"))))

Thanks, I confirm it's fixed not only for the reported case,
but generally for all uses of vc-diff in an empty repository.