Subject: bug#39285: 28.0.50; vc-dir on gitdir results in error

From: "Mark A. Hershberger" <[email-masked]>
Date: Sat, 25 Jan 2020 16:55:21 -0500

While trying projectile's "Browse dirty projects", I hit an error.  I
was able to reproduce this error using

    (vc-dir "/home/mah/work/code/emacs/.git/")

or any other git dir.

Here is the backtrace:

  substring(nil 0 0)
  replace-regexp-in-string("^stash@" "             " nil)
  vc-git-stash-list()
  vc-git-dir-extra-headers("/home/mah/work/code/emacs/.git/")
  apply(vc-git-dir-extra-headers "/home/mah/work/code/emacs/.git/")
  vc-call-backend(Git dir-extra-headers "/home/mah/work/code/emacs/.git/")
  vc-dir-headers(Git "/home/mah/work/code/emacs/.git/")
  vc-dir-refresh()
  vc-dir-mode()
  vc-dir("/home/mah/work/code/emacs/.git/")
  eval((vc-dir "/home/mah/work/code/emacs/.git/") t)
  eval-expression((vc-dir "/home/mah/work/code/emacs/.git/") nil nil 127)
  funcall-interactively(eval-expression (vc-dir "/home/mah/work/code/emacs/.git/") nil nil 127)
  call-interactively(eval-expression nil nil)
  command-execute(eval-expression)

In GNU Emacs 28.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.5, cairo version 1.16.0)
 of 2020-01-24 built on silk
Repository revision: ff630b56939541752097e5cc87c3db1de68d4c5f
Repository branch: master
Windowing system distributor 'The X.Org Foundation', version 11.0.12004000
System Description: Debian GNU/Linux 10 (buster)

Recent messages:
Entering debugger...
Mark set
next-line: End of buffer [10 times]
Saved text from "  substring(nil 0 0)
  replace-regexp-in"
Back to top level
Quit
Making completion list...
user-error: Beginning of history; no preceding item
user-error: End of history; no default available [2 times]

Configured using:
 'configure --with-modules --with-xwidgets --with-gconf --with-cairo
 --with-imagemagick'

Configured features:
XPM JPEG TIFF GIF PNG RSVG CAIRO IMAGEMAGICK SOUND GPM DBUS GCONF
GSETTINGS GLIB NOTIFY INOTIFY ACL LIBSELINUX GNUTLS LIBXML2 FREETYPE
HARFBUZZ M17N_FLT LIBOTF ZLIB TOOLKIT_SCROLL_BARS GTK3 X11 XDBE XIM
MODULES THREADS XWIDGETS LIBSYSTEMD JSON PDUMPER LCMS2 GMP

Important settings:
  value of $LANG: en_US.UTF-8
  value of $XMODIFIERS: @im=ibus
  locale-coding-system: utf-8-unix

Major mode: VC dir

Minor modes in effect:
  tooltip-mode: t
  global-eldoc-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  tool-bar-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  buffer-read-only: t
  line-number-mode: t
  transient-mark-mode: t

Load-path shadows:
None found.

Features:
(shadow sort mail-extr emacsbug message rmc puny dired dired-loaddefs
format-spec rfc822 mml mml-sec password-cache epa derived epg epg-config
gnus-util rmail rmail-loaddefs text-property-search time-date subr-x
mm-decode mm-bodies mm-encode mail-parse rfc2231 mailabbrev gmm-utils
mailheader sendmail rfc2047 rfc2045 ietf-drums mm-util mail-prsvr
mail-utils thingatpt help-fns radix-tree cl-print debug backtrace
help-mode find-func vc-git diff-mode easymenu easy-mmode vc-bzr vc-src
vc-sccs vc-svn vc-cvs vc-rcs vc-dir seq byte-opt gv bytecomp
byte-compile cconv ewoc vc cl-loaddefs cl-lib vc-dispatcher tooltip
eldoc electric uniquify ediff-hook vc-hooks lisp-float-type mwheel
term/x-win x-win term/common-win x-dnd tool-bar dnd fontset image
regexp-opt fringe tabulated-list replace newcomment text-mode elisp-mode
lisp-mode prog-mode register page tab-bar menu-bar rfn-eshadow isearch
timer select scroll-bar mouse jit-lock font-lock syntax facemenu
font-core term/tty-colors frame minibuffer cl-generic cham georgian
utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao korean
japanese eucjp-ms cp51932 hebrew greek romanian slovak czech european
ethiopic indian cyrillic chinese composite charscript charprop
case-table epa-hook jka-cmpr-hook help simple abbrev obarray
cl-preloaded nadvice loaddefs button faces cus-face macroexp files
text-properties overlay sha1 md5 base64 format env code-pages mule
custom widget hashtable-print-readable backquote threads dbusbind
inotify lcms2 dynamic-setting system-font-setting font-render-setting
xwidget-internal cairo move-toolbar gtk x-toolkit x multi-tty
make-network-process emacs)

Memory information:
((conses 16 63534 5598)
 (symbols 48 7744 1)
 (strings 32 22875 1739)
 (string-bytes 1 697483)
 (vectors 16 12421)
 (vector-slots 8 155309 11316)
 (floats 8 27 73)
 (intervals 56 347 0)
 (buffers 1000 16))