aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDan Nicolaescu2008-01-03 06:29:38 +0000
committerDan Nicolaescu2008-01-03 06:29:38 +0000
commitb936ef8cc215c32d78a24276e8e347ce86efd173 (patch)
tree9135c406f391ea1710af3deeb8c1bf45e4a2a27f
parent23233b1f8592d70afe1c8b64192b73b1df88148f (diff)
downloademacs-b936ef8cc215c32d78a24276e8e347ce86efd173.tar.gz
emacs-b936ef8cc215c32d78a24276e8e347ce86efd173.zip
* vc-git.el (vc-git--ls-files-state): New function.
(vc-git-dir-state): Use it instead of processing the status results here.
-rw-r--r--lisp/ChangeLog6
-rw-r--r--lisp/vc-git.el51
2 files changed, 24 insertions, 33 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 224a63ed283..06972d33e23 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,9 @@
12008-01-03 Alexandre Julliard <julliard@winehq.org>
2
3 * vc-git.el (vc-git--ls-files-state): New function.
4 (vc-git-dir-state): Use it instead of processing the status
5 results here.
6
12008-01-02 Eric S. Raymond <esr@snark.thyrsus.com> 72008-01-02 Eric S. Raymond <esr@snark.thyrsus.com>
2 8
3 * progmodes/grep.el (grep-find-ignored-directories): Initialize 9 * progmodes/grep.el (grep-find-ignored-directories): Initialize
diff --git a/lisp/vc-git.el b/lisp/vc-git.el
index 64bcbeb0b2b..c73c458fcb7 100644
--- a/lisp/vc-git.el
+++ b/lisp/vc-git.el
@@ -151,41 +151,26 @@
151 'edited 151 'edited
152 'up-to-date))) 152 'up-to-date)))
153 153
154(defun vc-git-dir-state (dir) 154(defun vc-git--ls-files-state (state &rest args)
155 "Git-specific version of `dir-state'." 155 "Set state to STATE on all files found with git-ls-files ARGS."
156 ;; FIXME: This can't set 'ignored yet
157 (with-temp-buffer 156 (with-temp-buffer
158 (vc-git-command (current-buffer) nil nil "ls-files" "-t" "-c" "-m" "-o") 157 (apply 'vc-git-command (current-buffer) nil nil "ls-files" "-z" args)
159 (goto-char (point-min)) 158 (goto-char (point-min))
160 (let ((status-char nil) 159 (let ((start (point)))
161 (file nil)) 160 (while (search-forward "\0" nil t)
162 (while (not (eobp)) 161 (let ((file (expand-file-name
163 (setq status-char (char-after)) 162 (buffer-substring-no-properties start (1- (point))))))
164 (setq file 163 (vc-file-setprop file 'vc-backend (if state 'Git 'none))
165 (expand-file-name 164 (vc-file-setprop file 'vc-state state))
166 (buffer-substring-no-properties (+ (point) 2) 165 (setq start (point))))))
167 (line-end-position)))) 166
168 (cond 167(defun vc-git-dir-state (dir)
169 ;; The rest of the possible states in "git ls-files -t" output: 168 "Git-specific version of `dir-state'."
170 ;; K to be killed 169 (vc-git--ls-files-state 'up-to-date "-c")
171 ;; should not show up in vc-dired, so don't deal with them 170 (vc-git--ls-files-state 'edited "-m")
172 ;; here. 171 (vc-git--ls-files-state 'removed "-d")
173 ((eq status-char ?H) 172 (vc-git--ls-files-state 'ignored "-o" "-i" "--exclude-standard")
174 (vc-file-setprop file 'vc-backend 'Git) 173 (vc-git--ls-files-state nil "-o" "--exclude-standard"))
175 (vc-file-setprop file 'vc-state 'up-to-date))
176 ((eq status-char ?R)
177 (vc-file-setprop file 'vc-backend 'Git)
178 (vc-file-setprop file 'vc-state 'removed))
179 ((eq status-char ?M)
180 (vc-file-setprop file 'vc-backend 'Git)
181 (vc-file-setprop file 'vc-state 'edited))
182 ((eq status-char ?C)
183 (vc-file-setprop file 'vc-backend 'Git)
184 (vc-file-setprop file 'vc-state 'edited))
185 ((eq status-char ??)
186 (vc-file-setprop file 'vc-backend 'none)
187 (vc-file-setprop file 'vc-state nil)))
188 (forward-line)))))
189 174
190(defun vc-git-working-revision (file) 175(defun vc-git-working-revision (file)
191 "Git-specific version of `vc-working-revision'." 176 "Git-specific version of `vc-working-revision'."