aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexandre Julliard <julliard@winehq.org>2006-03-04 17:38:20 +0100
committerJunio C Hamano <junkio@cox.net>2006-03-04 13:46:20 -0800
commitb23761d9ac0851f1af7edde1075f78835f539428 (patch)
tree1fc9cdfc84777d312b891e3a43e7c7717e45aa1c
parenta944652c054464ab3a70cead89df170602339512 (diff)
downloadgit-b23761d9ac0851f1af7edde1075f78835f539428.tar.gz
git-b23761d9ac0851f1af7edde1075f78835f539428.tar.xz
git.el: Automatically update .gitignore status.
Update .gitignore files in the status list as they are created or modified. Signed-off-by: Alexandre Julliard <julliard@winehq.org> Signed-off-by: Junio C Hamano <junkio@cox.net>
-rw-r--r--contrib/emacs/git.el11
1 files changed, 8 insertions, 3 deletions
diff --git a/contrib/emacs/git.el b/contrib/emacs/git.el
index 2363e48c2..335dcb2d4 100644
--- a/contrib/emacs/git.el
+++ b/contrib/emacs/git.el
@@ -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."
(let* ((fullname (expand-file-name file))
(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
- (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))
(unless (zerop (current-column)) (insert "\n"))
(insert name "\n")
(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