diff options
| -rw-r--r-- | lisp/ChangeLog | 7 | ||||
| -rw-r--r-- | lisp/vc-git.el | 20 |
2 files changed, 19 insertions, 8 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index ccca34f2150..91638c1dce8 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,10 @@ | |||
| 1 | 2008-03-24 Alexandre Julliard <julliard@winehq.org> | ||
| 2 | |||
| 3 | * vc-git.el (vc-git-after-dir-status-stage1): Move state matching | ||
| 4 | code ... | ||
| 5 | (vc-git--state-code): ... to this new function. | ||
| 6 | (vc-git-state): Use it. | ||
| 7 | |||
| 1 | 2008-03-24 Trent Buck <trentbuck@gmail.com> (tiny change) | 8 | 2008-03-24 Trent Buck <trentbuck@gmail.com> (tiny change) |
| 2 | 9 | ||
| 3 | * textmodes/remember.el (remember-mail-date) | 10 | * textmodes/remember.el (remember-mail-date) |
diff --git a/lisp/vc-git.el b/lisp/vc-git.el index 82c00677169..f75c4b8b810 100644 --- a/lisp/vc-git.el +++ b/lisp/vc-git.el | |||
| @@ -141,14 +141,23 @@ | |||
| 141 | (string= (substring str 0 (1+ (length name))) | 141 | (string= (substring str 0 (1+ (length name))) |
| 142 | (concat name "\0"))))))))) | 142 | (concat name "\0"))))))))) |
| 143 | 143 | ||
| 144 | (defun vc-git--state-code (code) | ||
| 145 | "Convert from a string to a added/deleted/modified state." | ||
| 146 | (case (string-to-char code) | ||
| 147 | (?M 'edited) | ||
| 148 | (?A 'added) | ||
| 149 | (?D 'removed) | ||
| 150 | (?U 'edited) ;; FIXME | ||
| 151 | (?T 'edited))) ;; FIXME | ||
| 152 | |||
| 144 | (defun vc-git-state (file) | 153 | (defun vc-git-state (file) |
| 145 | "Git-specific version of `vc-state'." | 154 | "Git-specific version of `vc-state'." |
| 146 | ;; FIXME: This can't set 'ignored yet | 155 | ;; FIXME: This can't set 'ignored yet |
| 147 | (vc-git--call nil "add" "--refresh" "--" (file-relative-name file)) | 156 | (vc-git--call nil "add" "--refresh" "--" (file-relative-name file)) |
| 148 | (let ((diff (vc-git--run-command-string file "diff-index" "-z" "HEAD" "--"))) | 157 | (let ((diff (vc-git--run-command-string file "diff-index" "-z" "HEAD" "--"))) |
| 149 | (if (and diff (string-match ":[0-7]\\{6\\} [0-7]\\{6\\} [0-9a-f]\\{40\\} [0-9a-f]\\{40\\} \\([ADMU]\\)\0[^\0]+\0" | 158 | (if (and diff (string-match ":[0-7]\\{6\\} [0-7]\\{6\\} [0-9a-f]\\{40\\} [0-9a-f]\\{40\\} \\([ADMUT]\\)\0[^\0]+\0" |
| 150 | diff)) | 159 | diff)) |
| 151 | (if (string= (match-string 1 diff) "A") 'added 'edited) | 160 | (vc-git--state-code (match-string 1 diff)) |
| 152 | (if (vc-git--empty-db-p) 'added 'up-to-date)))) | 161 | (if (vc-git--empty-db-p) 'added 'up-to-date)))) |
| 153 | 162 | ||
| 154 | (defun vc-git--ls-files-state (state &rest args) | 163 | (defun vc-git--ls-files-state (state &rest args) |
| @@ -216,12 +225,7 @@ | |||
| 216 | ":[0-7]\\{6\\} [0-7]\\{6\\} [0-9a-f]\\{40\\} [0-9a-f]\\{40\\} \\([ADMUT]\\)\0\\([^\0]+\\)\0" | 225 | ":[0-7]\\{6\\} [0-7]\\{6\\} [0-9a-f]\\{40\\} [0-9a-f]\\{40\\} \\([ADMUT]\\)\0\\([^\0]+\\)\0" |
| 217 | nil t 1) | 226 | nil t 1) |
| 218 | (let ((filename (match-string 2)) | 227 | (let ((filename (match-string 2)) |
| 219 | (status (case (string-to-char( match-string 1)) | 228 | (status (vc-git--state-code (match-string 1)))) |
| 220 | (?M 'edited) | ||
| 221 | (?A 'added) | ||
| 222 | (?D 'removed) | ||
| 223 | (?U 'edited) ;; FIXME | ||
| 224 | (?T 'edited)))) ;; FIXME | ||
| 225 | (push (cons filename status) vc-git-status-result))) | 229 | (push (cons filename status) vc-git-status-result))) |
| 226 | (erase-buffer) | 230 | (erase-buffer) |
| 227 | (vc-git-command (current-buffer) 'async nil "ls-files" "-z" "-o" | 231 | (vc-git-command (current-buffer) 'async nil "ls-files" "-z" "-o" |