-----\r
\r
If you have a recent enough version installed, it defines\r
-`magit-revert-buffer-hook`, which we use.\r
+`magit-revert-buffer-hook` (or `magit-not-reverted-hook`), which we use.\r
;; doesn't care about changed VC state.\r
;; https://github.com/magit/magit/issues/603\r
(add-hook 'magit-revert-buffer-hook 'diff-hl-update nil t)\r
+ ;; Magit 2+ doesn't do the above and calls this instead,\r
+ ;; but only when it doesn't call `revert-buffer':\r
+ (add-hook 'magit-not-reverted-hook 'diff-hl-update nil t)\r
(add-hook 'auto-revert-mode-hook 'diff-hl-update nil t)\r
(add-hook 'text-scale-mode-hook 'diff-hl-define-bitmaps nil t))\r
(remove-hook 'after-save-hook 'diff-hl-update t)\r
(remove-hook 'vc-checkin-hook 'diff-hl-update t)\r
(remove-hook 'after-revert-hook 'diff-hl-update t)\r
(remove-hook 'magit-revert-buffer-hook 'diff-hl-update t)\r
+ (remove-hook 'magit-not-reverted-hook 'diff-hl-update t)\r
(remove-hook 'auto-revert-mode-hook 'diff-hl-update t)\r
(remove-hook 'text-scale-mode-hook 'diff-hl-define-bitmaps t)\r
(diff-hl-remove-overlays)))\r