Subject: 27.0.50; vc-revert: No such file or directory vc-nil
From: Andrii Kolomoiets <[email-masked]>
To: [email-masked]
Date: Thu, 5 Sep 2019 16:51:17 +0300
List-Id: <debbugs-submit.debbugs.gnu.org>

Steps to reproduce:

1. mkdir gittest && cd gittest
2. git init
3. echo "foo" > bar.txt
4. git add bar.txt
5. git commit -m "bar.txt added"
6. echo "baz" >> bar.txt
7. emacs -Q
8. C-x v d <RET> -- to open vc-dir for gittest directory
9. C-x v u
10. yes <RET> -- to confirm revert

Debugger entered--Lisp error: (file-missing "Cannot open load file" "No such file or directory" "vc-nil")
  require(vc-nil)
  vc-find-backend-function(nil make-version-backups-p)
  vc-call-backend(nil make-version-backups-p "/Users/mad/gittest/")
  vc-version-backup-file("/Users/mad/gittest/")
  vc-revert-file("/Users/mad/gittest/")
  vc-revert()
  funcall-interactively(vc-revert)
  call-interactively(vc-revert nil nil)
  command-execute(vc-revert)

Changing 'git' to 'hg' in the steps to reproduce above leads to the same
error.
Same issue in Emacs 26.3.

vc-backend returns nil for repository root dir. Maybe vc-registered
should return t for root repository directory and all subdirs.
Evaluating (vc-find-root "/Users/mad/gittest" ".git") returns
"~/gittest/" but (vc-registered "/Users/mad/gittest") returns nil.