git.el: Reset the permission flags when changing a file state.
Signed-off-by: Alexandre Julliard <julliard@winehq.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Alexandre Julliard committed
Sep 29, 2007 at 11:59 UTC
72dc52bfe6c56e37f290dd2c428d82686d6647df
1 file changed
+11
-17
contrib/emacs/git.el
+11
-17
@@ -484,14 +484,15 @@ and returns the process output as a string."
484
"Remove everything from the status list."
485
(ewoc-filter status (lambda (info) nil)))
486
487
-(defun git-set-files-state (files state)
488
- "Set the state of a list of files."
489
- (dolist (info files)
490
- (unless (eq (git-fileinfo->state info) state)
491
- (setf (git-fileinfo->state info) state)
492
- (setf (git-fileinfo->rename-state info) nil)
493
- (setf (git-fileinfo->orig-name info) nil)
494
- (setf (git-fileinfo->needs-refresh info) t))))
487
+(defun git-set-fileinfo-state (info state)
488
+ "Set the state of a file info."
489
+ (unless (eq (git-fileinfo->state info) state)
490
+ (setf (git-fileinfo->state info) state
491
+ (git-fileinfo->old-perm info) 0
492
+ (git-fileinfo->new-perm info) 0
493
+ (git-fileinfo->rename-state info) nil
494
+ (git-fileinfo->orig-name info) nil
495
+ (git-fileinfo->needs-refresh info) t)))
496
497
(defun git-status-filenames-map (status func files &rest args)
498
"Apply FUNC to the status files names in the FILES list."
@@ -510,14 +511,7 @@ and returns the process output as a string."
511
(defun git-set-filenames-state (status files state)
512
"Set the state of a list of named files."
513
(when files
513
- (git-status-filenames-map status
514
- (lambda (info state)
515
- (unless (eq (git-fileinfo->state info) state)
516
- (setf (git-fileinfo->state info) state)
517
- (setf (git-fileinfo->rename-state info) nil)
518
- (setf (git-fileinfo->orig-name info) nil)
519
- (setf (git-fileinfo->needs-refresh info) t)))
520
- files state)
514
+ (git-status-filenames-map status #'git-set-fileinfo-state files state)
515
(unless state ;; delete files whose state has been set to nil
516
(ewoc-filter status (lambda (info) (git-fileinfo->state info))))))
517
@@ -800,7 +794,7 @@ Return the list of files that haven't been handled."
794
(condition-case nil (delete-file ".git/MERGE_HEAD") (error nil))
795
(condition-case nil (delete-file ".git/MERGE_MSG") (error nil))
796
(with-current-buffer buffer (erase-buffer))
803
- (git-set-files-state files 'uptodate)
797
+ (dolist (info files) (git-set-fileinfo-state info 'uptodate))
798
(git-call-process-env nil nil "rerere")
799
(git-refresh-files)
800
(git-refresh-ewoc-hf git-status)