提交 b23761d9 编写于 作者: A Alexandre Julliard 提交者: Junio C Hamano

git.el: Automatically update .gitignore status.

Update .gitignore files in the status list as they are created or
modified.
Signed-off-by: NAlexandre Julliard <julliard@winehq.org>
Signed-off-by: NJunio C Hamano <junkio@cox.net>
上级 a944652c
...@@ -213,14 +213,19 @@ If not set, fall back to `add-log-mailing-address' and then `user-mail-address'. ...@@ -213,14 +213,19 @@ If not set, fall back to `add-log-mailing-address' and then `user-mail-address'.
"Add a file name to the ignore file in its directory." "Add a file name to the ignore file in its directory."
(let* ((fullname (expand-file-name file)) (let* ((fullname (expand-file-name file))
(dir (file-name-directory fullname)) (dir (file-name-directory fullname))
(name (file-name-nondirectory fullname))) (name (file-name-nondirectory fullname))
(ignore-name (expand-file-name git-per-dir-ignore-file dir))
(created (not (file-exists-p ignore-name))))
(save-window-excursion (save-window-excursion
(set-buffer (find-file-noselect (expand-file-name git-per-dir-ignore-file dir))) (set-buffer (find-file-noselect ignore-name))
(goto-char (point-max)) (goto-char (point-max))
(unless (zerop (current-column)) (insert "\n")) (unless (zerop (current-column)) (insert "\n"))
(insert name "\n") (insert name "\n")
(sort-lines nil (point-min) (point-max)) (sort-lines nil (point-min) (point-max))
(save-buffer)))) (save-buffer))
(when created
(git-run-command nil nil "update-index" "--info-only" "--add" "--" (file-relative-name ignore-name)))
(git-add-status-file (if created 'added 'modified) (file-relative-name ignore-name))))
;;;; Wrappers for basic git commands ;;;; Wrappers for basic git commands
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册