8000 Deleted files are still shown in projectile-find-file · Issue #1148 · bbatsov/projectile · GitHub
[go: up one dir, main page]

Skip to content

Deleted files are still shown in projectile-find-file #1148

@raxod502

Description

@raxod502

Expected behavior

Suppose that I have a Git repository with some files committed to it. When I delete one of those files in my working directory, it should no longer show up in projectile-find-file.

Actual behavior

All files in Git's index are shown in projectile-find-file. When I have renamed a file, this causes both the old path and the new path to show up in projectile-find-file. If the old path is listed earlier than the new path, this causes me to inadvertently re-create a file at the old path.

Steps to reproduce the problem

$ mkdir example-git-repo
$ cd example-git-repo
$ git init
$ touch existing-file nonexistent-file
$ git add existing-file nonexistent-file
$ git commit -m "Add two files"
$ rm nonexistent-file
$ emacs -Q
M-x projectile-find-file

Observe that both existing-file and nonexistent-file are listed, whereas only existing-file should be listed.

$ git add nonexistent-file
$ emacs -Q
M-x projectile-find-file

Observe that nonexistent-file is no longer listed if its deletion is added to the index.

Cause

This is because Projectile uses git ls-files in projectile-git-command, and git ls-files shows files in the index, not files in the working directory.

Environment & Version information

Projectile version information

Revision 56e262d, version 0.15.0snapshot.

Emacs version

GNU Emacs 25.2.1 from brew cask install emacs.

Operating system

                -/+:.           
               :++++.           
              /+++/.            OS: macOS Sierra 10.12.5 16F73 x86_64
      .:-::- .+/:-``.::-        Model: MacBookPro11,4
   .:/++++++/::::/++++++/:`     Kernel: 16.6.0
 .:///////////////////////:`    Uptime: 2 days, 8 hours, 4 mins
 ////////////////////////`      Packages: 203
-+++++++++++++++++++++++`       Shell: zsh 5.3.1
/++++++++++++++++++++++/        Resolution: 1440x900
/sssssssssssssssssssssss.       DE: Aqua
:ssssssssssssssssssssssss-      WM: Quartz Compositor
 osssssssssssssssssssssssso/`   Terminal: iTerm2
 `syyyyyyyyyyyyyyyyyyyyyyyy+`   Terminal Font: InputMono-Medium 12
  `ossssssssssssssssssssss/     CPU: Intel i7-4980HQ (8) @ 2.80GHz
    :ooooooooooooooooooo+.      GPU: Intel Iris Pro
     `:+oo+/:-..-:/+o+/-        Memory: 3607MiB / 16384MiB

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0