Xuyuanp / nerdtree-git-plugin

A plugin of NERDTree showing git status
Do What The F*ck You Want To Public License
2.08k stars 150 forks source link

Status line spammed and no git status icons when files or subdirectories have permission clash #164

Closed ebardie closed 3 years ago

ebardie commented 4 years ago

Self-Diagnosis

Environment (for bug reports)

Unusual corner cases:

a) Run vim within a git controlled directory that has a directory which itself has subdirectories owned by a different user (in my case 'root') which the active user doesn't have permission to open.

    . - subdir - dir1
               - dir2
               - dir3
               - dir4
               - dir5
               - dir6
               - dir7
               - dir8

where `.` and `subdir` are owned by the active user and can be opened, and `dir1` through `dir8` are owned by another user and the active user doesn't have the permissions to open them.

or:

b) Run vim in a git controlled directory which contains a file owned by another user, and which the active user can't open.

I've come across situation (a) in the wild (hence this issue and associated PR) and constructed situation (b) when producing the proposed fix in the PR.

Current Result (Include screenshots where appropriate.)

Two problems ensue:

i) Vim's status is spammed with error reports:

    [nertdtree-git-status] job[init] failed: warning: could not open directory 'subdirname/dir1': Permission deniedwarning: could not open directory 'subdirname/dir2': Permission deniedwarning: could not open directory 'subdirname/dir3': Permission deniedwarning: could not open directory 'subdirname/dir4': Permission deniedwarning: could not open directory 'subdirname/dir5': Permission deniedwarning: could not open directory 'subdirname/dir6': Permission deniedwarning: could not open directory 'subdirname/dir7': Permission deniedwarning: could not open directory 'subdirname/dir8': Permission denied

ii) the git status icons which are normally displayed, are not displayed; even for other directories

Expected Result

git status icons are displayed