Open zmyrgel opened 3 years ago
Yup, that would be nice. Could you please test the following patch? I didn't have the time right now to test it throughtfully, but from some quick testing it seems to work:
diff 7a5ead659d51fa249e2af1fcbf0ad79e969e5204 /home/op/w/vc-got
blob - f4121be3feb070ae066dc0f81880d080e4d30251
file + vc-got.el
--- vc-got.el
+++ vc-got.el
@@ -380,7 +380,9 @@ DIR-OR-FILE."
;; collect deleted and removed files
(cl-loop for (file . st) in stats
do (when (or (eq st 'missing)
- (eq st 'removed))
+ (eq st 'removed)
+ (eq st 'edited)
+ (eq st 'added))
(push (list file st nil) res)))
(cl-loop for file in fs
do (let ((s (if (file-directory-p file)
Close, it still lists the "unregistered .emacs.d" but adds empty dir and edited line at the end:
up-to-date .conkyrc
up-to-date .cvsrc
up-to-date .cwmrc
up-to-date .eclrc
unregistered .emacs.d
unregistered .fluxbox
unregistered .i3
up-to-date .i3status.conf
unregistered .icewm
up-to-date .ksh_logout
up-to-date .kshrc
unregistered .mplayer
unregistered .pekwm
up-to-date .profile
up-to-date .redshift
up-to-date .sbclrc
up-to-date .scrotwm.conf
unregistered .shell
up-to-date .stumpwmrc
edited .xinitrc
edited .xinitrc
up-to-date README.org
.emacs.d/
edited .emacs.d/init.el
Second round!
This is a better approach, as reuses all the output from got status
, and only adds the 'up-to-date files in the current directory to the list. I was marking directories as 'unregistered because git and got don't track directories and I though a valid symbol was needed. It seems that we can simply ignore them (at least in vc-got-dir-status-files) so here we go.
With this I don't see regression in "flat" repos and I get this when a file in a subdirectory was edited:
./
up-to-date foo
bar/baz/
edited bar/baz/quux
diff 7a5ead659d51fa249e2af1fcbf0ad79e969e5204 /home/op/w/vc-got
blob - f4121be3feb070ae066dc0f81880d080e4d30251
file + vc-got.el
--- vc-got.el
+++ vc-got.el
@@ -376,21 +376,16 @@ DIR-OR-FILE."
(or files
(directory-files dir))))
(stats (vc-got--parse-status (apply #'vc-got--status dir files)))
- (res))
- ;; collect deleted and removed files
- (cl-loop for (file . st) in stats
- do (when (or (eq st 'missing)
- (eq st 'removed))
- (push (list file st nil) res)))
+ (res (mapcar (lambda (x)
+ (list (car x) (cdr x) nil))
+ stats)))
(cl-loop for file in fs
- do (let ((s (if (file-directory-p file)
- (list file 'unregistered nil)
- (if-let (status (cdr (assoc file stats #'string=)))
- (list file status nil)
+ do (let ((s (unless (or (cdr (assoc file stats #'string=))
+ (file-directory-p file))
+ (when (file-exists-p file)
;; if file doesn't exists, it's a
;; untracked file that was removed.
- (when (file-exists-p file)
- (list file 'up-to-date nil))))))
+ (list file 'up-to-date nil)))))
(when s
(push s res)))
finally (funcall update-function res nil))))
No need to copy paste, I pushed that diff as commit 8ed796d4347e6530a37aee28080c8c4de842c01e
Better still but I'd say it should keep the same order.
./
up-to-date .conkyrc
up-to-date .cvsrc
up-to-date .cwmrc
up-to-date .eclrc
up-to-date .i3status.conf
up-to-date .ksh_logout
up-to-date .kshrc
up-to-date .profile
up-to-date .redshift
up-to-date .sbclrc
up-to-date .scrotwm.conf
up-to-date .stumpwmrc
edited .xinitrc
up-to-date README.org
.emacs.d/
edited .emacs.d/init.el
As shown above the directories containing changes are pushed at the end of dired list.
unfortunately it doesn't seem that vc-got-dir-status-files has control over it. I tried to nreverse
the computed result without observing differences in *vc-dir*
. I'll investigate that.
I have got worktree ~/dotfiles, in it I have .emacs.d directory and in there a file init.el which is modified. On vc-dir on dotfiles it just lists "unregistered emacs.d".
Same directory structure viewed on vc-git:
Got should display something similar so changes in sub-directories are handled.