git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* [PATCH 3/5] git.el: Automatically update .gitignore status.
@ 2006-03-04 16:38 Alexandre Julliard
  0 siblings, 0 replies; only message in thread
From: Alexandre Julliard @ 2006-03-04 16:38 UTC (permalink / raw
  To: git

Update .gitignore files in the status list as they are created or
modified.

Signed-off-by: Alexandre Julliard <julliard@winehq.org>

---

 contrib/emacs/git.el |   11 ++++++++---
 1 files changed, 8 insertions(+), 3 deletions(-)

403b5738e69df610ab625085ccbd771a466b7af8
diff --git a/contrib/emacs/git.el b/contrib/emacs/git.el
index 2363e48..335dcb2 100644
--- a/contrib/emacs/git.el
+++ b/contrib/emacs/git.el
@@ -213,14 +213,19 @@ If not set, fall back to `add-log-mailin
   "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
-- 
1.2.4.g0040-dirty

-- 
Alexandre Julliard
julliard@winehq.org

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2006-03-04 16:38 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-03-04 16:38 [PATCH 3/5] git.el: Automatically update .gitignore status Alexandre Julliard

Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).