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

From: Juri Linkov <[email-masked]>
Date: Sun, 13 Jul 2025 19:51:25 +0300

The first 'C-x v v' works now.  Then I tried the second 'C-x v v'
on the new file, but it fails because I customized
'log-edit-hook' and added 'log-edit-maybe-show-diff' to it:

Debugger entered--Lisp error: (error "Failed (status 128): git --no-pager diff-index --exit-code -p HEAD  -- file")
  signal(error ("Failed (status 128): git --no-pager diff-index --exit-code -p HEAD  -- file"))
  error("Failed (%s): %s" "status 128" "git --no-pager diff-index --exit-code -p HEAD  -- file")
  vc-do-command("*vc-diff*" 1 "git" ("/tmp/dir/file") "--no-pager" "diff-index" "--exit-code" "-p" "HEAD" nil "--")
  vc-git-command("*vc-diff*" 1 ("/tmp/dir/file") "diff-index" "--exit-code" "-p" "HEAD" nil "--")
  vc-git-diff(("/tmp/dir/file") nil nil "*vc-diff*" nil)
  vc-call-backend(Git diff ("/tmp/dir/file") nil nil "*vc-diff*" nil)
  vc-diff-internal(nil (Git ("/tmp/dir/file")) nil nil nil)
  vc-diff(nil not-essential (Git ("/tmp/dir/file")))
  log-edit-diff-fileset()
  log-edit-maybe-show-diff()
  log-edit(vc-finish-logentry t ...
  vc-log-edit(("/tmp/dir/file") ...
  vc-start-logentry(("/tmp/dir/file") nil nil ...
  vc-checkin(("/tmp/dir/file") Git nil nil nil nil nil)
  vc-next-action(nil)
  dired-vc-next-action(nil)
  funcall-interactively(dired-vc-next-action nil)
  command-execute(dired-vc-next-action)

Do you have an idea how to handle an empty repository on the first commit?
Or this needs a separate bug report?