GNU bug report logs -
#21559
25.0.50; auto-revert-mode breaks git rebase
Previous Next
Reported by: Ben Gamari <ben <at> smart-cactus.org>
Date: Fri, 25 Sep 2015 14:31:02 UTC
Severity: normal
Found in version 25.0.50
Fixed in version 27.1
Done: Michael Albinus <michael.albinus <at> gmx.de>
Bug is archived. No further changes may be made.
Full log
View this message in rfc822 format
Ben Gamari <ben <at> smart-cactus.org> writes:
> Hi Michael,
Hi Ben,
> Ultimately the problem here is an annoyingly narrow one, namely the fact
> that auto-revert's action is correlated with file modifications due to
> rebasing. For this reason I think it may be best to keep the solution
> confined to auto-revert.
>
> In particular, I'm afraid that the changing the semantics of
> revert-buffer may break other users of this function who expect
> its effect to be apparent immediately after invocation. It seems like
> this approach may easily and unwittingly trade one subtle form of
> breakage for another (even harder to find) one.
I agree with you not to change the behaviour of revert-buffer for other
use cases but auto-revert. One could do it by introducing a new local
variable auto-revert-buffer-in-progress-p (similar to
revert-buffer-in-progress-p), which is bound during auto-revert. Then it
would be possible to define a new function
(defun vc-git-revert-buffer-function (ignore-auto noconfirm)
"vc-git specific revert function."
(if (and auto-revert-buffer-in-progress-p
(check-for-git-rebase))
(do-something-special)
(revert-buffer--default ignore-auto noconfirm)))
One could also check, whether adding a function to before-revert-hook
could be helpful.
An alternative, w/o touching revert-buffer for vc-git files, would be
the provisiong of a special buffer-stale-function for vc-git. Something
like
(defun vc-git-buffer-stale-p (&optional noconfirm)
"vc-git specific buffer-stale function."
(check-that-git-needs-revert-and-it-is-safe-to-do-so))
This function returns t, when a buffer with a file under vc-git mode
needs a revert, and it is safe to revert it (no git rebase is
running). When autorevert either polls, or it is indicated by a file
notification event, it calls this function and reverts the buffer if the
function returns non-nil. If the function returns nil, auto-revert is
skipped for that buffer, and it is checked again by the next poll (after
5 seconds). By this, autorevert.el would stay clean (no additional vc
related code), and you would even not need to implement an own timer.
> Cheers,
>
> - Ben
Best regards, Michael.
This bug report was last modified 6 years and 294 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.