aboutsummaryrefslogtreecommitdiffstats
path: root/lisp
diff options
context:
space:
mode:
Diffstat (limited to 'lisp')
-rw-r--r--lisp/vc/vc.el13
1 files changed, 9 insertions, 4 deletions
diff --git a/lisp/vc/vc.el b/lisp/vc/vc.el
index 4cac1539289..c982b0220e3 100644
--- a/lisp/vc/vc.el
+++ b/lisp/vc/vc.el
@@ -1417,17 +1417,22 @@ remove from the list of ignored files."
1417 1417
1418(defun vc-default-ignore (backend file &optional directory remove) 1418(defun vc-default-ignore (backend file &optional directory remove)
1419 "Ignore FILE under the VCS of DIRECTORY (default is `default-directory'). 1419 "Ignore FILE under the VCS of DIRECTORY (default is `default-directory').
1420FILE is a file wildcard, relative to the root directory of DIRECTORY. 1420FILE is a wildcard specification, either relative to
1421DIRECTORY or absolute.
1421When called from Lisp code, if DIRECTORY is non-nil, the 1422When called from Lisp code, if DIRECTORY is non-nil, the
1422repository to use will be deduced by DIRECTORY; if REMOVE is 1423repository to use will be deduced by DIRECTORY; if REMOVE is
1423non-nil, remove FILE from ignored files. 1424non-nil, remove FILE from ignored files.
1424Argument BACKEND is the backend you are using." 1425Argument BACKEND is the backend you are using."
1425 (let ((ignore 1426 (let ((ignore
1426 (vc-call-backend backend 'find-ignore-file (or directory default-directory))) 1427 (vc-call-backend backend 'find-ignore-file (or directory default-directory)))
1427 (pattern (file-relative-name 1428 file-path root-dir pattern)
1428 (expand-file-name file) (file-name-directory file)))) 1429 (setq file-path (expand-file-name file directory))
1430 (setq root-dir (file-name-directory ignore))
1431 (when (not (string= (substring file-path 0 (length root-dir)) root-dir))
1432 (error "Ignore spec %s is not below project root %s" file-path root-dir))
1433 (setq pattern (substring file-path (length root-dir)))
1429 (if remove 1434 (if remove
1430 (vc--remove-regexp pattern ignore) 1435 (vc--remove-regexp (concat "^" (regexp-quote pattern ) "\\(\n\\|$\\)") ignore)
1431 (vc--add-line pattern ignore)))) 1436 (vc--add-line pattern ignore))))
1432 1437
1433(defun vc-default-ignore-completion-table (backend file) 1438(defun vc-default-ignore-completion-table (backend file)