Subject: bug#24082: vc-dir changes working directory (git backend)

From: Steve Revilak <[email-masked]>
Date: Fri, 29 Jul 2016 20:35:21 -0400

I'd like to submit some additional information.  I seem similar (but
not identical behavior) when git is used as the vc backend.

I am using emacs version

   GNU Emacs 25.1.1 (x86_64-unknown-linux-gnu, GTK+ Version 3.14.15) of 2016-07-29

I've attached a small shell script to assist in reproducing the
behavior.  The script creates a git repository and commits two files
./my-repo/file1.txt and ./my-repo/file2.txt.  The script also creates
(an unregistered) file ./my-repo/new-file.txt.

STEPS TO REPRODUCE:

  sh mk-repository.sh
  emacs -Q
  C-x f my-repo/subdir RET
  C-x v d

At this point emacs prompts "VC status for directory: ~/my-repo",
although the buffer's working directory was "~/my-repo/subdir".

I press RET at the "VC status for directory: ~/my-repo".  Here's what
I see

---------------------------------
VC backend : Git
Working dir: ~/my-repo/
Branch     : master
Remote     : 
Stash      : Nothing stashed

                          ./
      unregistered        new-file.txt
---------------------------------

When performing these steps with emacs-24.5:

  - After pressing C-x v d, emacs prompts
    "VC status for directory: ~/my-repo/subdir/"

  - I press RET and see

---------------------------------
VC backend : Git
Working dir: ~/my-repo/subdir/
Branch     : master
Remote     : 
Stash      : Nothing stashed

                          ./
---------------------------------

I agree with the reporter: the VC status is being reported from the
top-level of the repository, as opposed to the buffer's working
directory.

emacs-25.0.90 behaves the same way as emacs 25.1-rc1

Unlike the CVS report, '=' (in vc-dir) behaves as I would expect: it
shows me a diff of the file at point.