From 4d3ac01e411ed927223d2774fb3e75bf0b2f71bd Mon Sep 17 00:00:00 2001 From: Dan Nicolaescu Date: Mon, 23 Jul 2007 15:02:16 +0000 Subject: [PATCH] (vc-git-workfile-unchanged-p): Update comment. --- lisp/ChangeLog | 4 ++++ lisp/vc-git.el | 14 +++++++++++++- 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 66ec40aadc7..c46ad1166bc 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,7 @@ +2007-07-23 Alexandre Julliard + + * vc-git.el (vc-git-workfile-unchanged-p): Update comment. + 2007-07-20 Kenichi Handa * international/utf-8.el (utf-8-post-read-conversion): Temporarily diff --git a/lisp/vc-git.el b/lisp/vc-git.el index df09fc5b885..8b46c957cdf 100644 --- a/lisp/vc-git.el +++ b/lisp/vc-git.el @@ -191,8 +191,20 @@ (defun vc-git-checkout-model (file) 'implicit) -;; XXX Can't this just use the result of vc-git-state? (defun vc-git-workfile-unchanged-p (file) + ;; The reason this does not use the result of vc-git-state is that + ;; git-diff-index (used by vc-git-state) doesn't refresh the cached + ;; stat info, so if the file has been modified it will always show + ;; up as modified in vc-git-state, even if the change has been + ;; undone, until git-update-index --refresh is run. + + ;; OTOH the vc-git-workfile-unchanged-p implementation checks the + ;; actual content, so it will detect the case of a file reverted + ;; back to its original state. + + ;; The ideal implementation would be to refresh the stat cache and + ;; then call vc-git-state, but at the moment there's no git command + ;; to refresh a single file, so this will have to be added first. (let ((sha1 (vc-git--run-command-string file "hash-object" "--")) (head (vc-git--run-command-string file "ls-tree" "-z" "HEAD" "--"))) (and head -- 2.39.5