vc-dir-ignore: More accurately choose base directory
* lisp/vc/vc-dir.el: (vc-dir-ignore): Use it (bug#37189). * lisp/vc/vc.el: (vc--ignore-base-dir): Extract from vc-ignore.
This commit is contained in:
parent
e74fb4688b
commit
9ec6eb1065
2 changed files with 14 additions and 11 deletions
|
@ -879,9 +879,10 @@ If a prefix argument is given, ignore all marked files."
|
||||||
(vc-ignore (vc-dir-fileinfo->name filearg))
|
(vc-ignore (vc-dir-fileinfo->name filearg))
|
||||||
t))
|
t))
|
||||||
vc-ewoc)
|
vc-ewoc)
|
||||||
(vc-ignore
|
(let ((rel-dir (vc--ignore-base-dir)))
|
||||||
(file-relative-name (vc-dir-current-file))
|
(vc-ignore
|
||||||
default-directory)))
|
(file-relative-name (vc-dir-current-file) rel-dir)
|
||||||
|
rel-dir))))
|
||||||
|
|
||||||
(defun vc-dir-current-file ()
|
(defun vc-dir-current-file ()
|
||||||
(let ((node (ewoc-locate vc-ewoc)))
|
(let ((node (ewoc-locate vc-ewoc)))
|
||||||
|
|
|
@ -1406,14 +1406,7 @@ When called interactively, prompt for a FILE to ignore, unless a
|
||||||
prefix argument is given, in which case prompt for a file FILE to
|
prefix argument is given, in which case prompt for a file FILE to
|
||||||
remove from the list of ignored files."
|
remove from the list of ignored files."
|
||||||
(interactive
|
(interactive
|
||||||
(let* ((backend (vc-responsible-backend default-directory))
|
(let* ((rel-dir (vc--ignore-base-dir))
|
||||||
(rel-dir
|
|
||||||
(condition-case nil
|
|
||||||
(file-name-directory
|
|
||||||
(vc-call-backend backend 'find-ignore-file
|
|
||||||
default-directory))
|
|
||||||
(vc-not-supported
|
|
||||||
default-directory)))
|
|
||||||
(file (read-file-name "File to ignore: ")))
|
(file (read-file-name "File to ignore: ")))
|
||||||
(when (and (file-name-absolute-p file)
|
(when (and (file-name-absolute-p file)
|
||||||
(file-in-directory-p file rel-dir))
|
(file-in-directory-p file rel-dir))
|
||||||
|
@ -1426,6 +1419,15 @@ remove from the list of ignored files."
|
||||||
(error "Unknown backend"))))
|
(error "Unknown backend"))))
|
||||||
(vc-call-backend backend 'ignore file directory remove)))
|
(vc-call-backend backend 'ignore file directory remove)))
|
||||||
|
|
||||||
|
(defun vc--ignore-base-dir ()
|
||||||
|
(let ((backend (vc-responsible-backend default-directory)))
|
||||||
|
(condition-case nil
|
||||||
|
(file-name-directory
|
||||||
|
(vc-call-backend backend 'find-ignore-file
|
||||||
|
default-directory))
|
||||||
|
(vc-not-supported
|
||||||
|
default-directory))))
|
||||||
|
|
||||||
(defun vc-default-ignore (backend file &optional directory remove)
|
(defun vc-default-ignore (backend file &optional directory remove)
|
||||||
"Ignore FILE under DIRECTORY (default is `default-directory').
|
"Ignore FILE under DIRECTORY (default is `default-directory').
|
||||||
FILE is a wildcard specification relative to DIRECTORY.
|
FILE is a wildcard specification relative to DIRECTORY.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue