diff-hl
diff-hl copied to clipboard
Error on startup
Hi I got this error when opening my init file
(error "Failed (%s): %s" "status 128" "git --no-pager diff-index --exit-code -U0 -p 4b825...")
(vc-do-command " *diff-hl* " 1 "git" ("/home/ergo/.config/emacs/init.el") "--no-pager" "diff-index" "--exit-code" "-U0" "-p" "4b825dc642cb6eb9a060e54bf8d69288fbee4904" nil "--")
(vc-git-command " *diff-hl* " 1 ("/home/ergo/.config/emacs/init.el") "diff-index" "--exit-code" "-U0" "-p" "4b825dc642cb6eb9a060e54bf8d69288fbee4904" nil "--")
(vc-git-diff ("/home/ergo/.config/emacs/init.el") "4b825dc642cb6eb9a060e54bf8d69288fbee4904" nil " *diff-hl* " nil)
(vc-call-backend Git diff ("/home/ergo/.config/emacs/init.el") "4b825dc642cb6eb9a060e54bf8d69288fbee4904" nil " *diff-hl* ")
(diff-hl-diff-against-reference "/home/ergo/.config/emacs/init.el" Git " *diff-hl* ")
(diff-hl-changes-buffer "/home/ergo/.config/emacs/init.el" Git)
(diff-hl-changes)
(diff-hl-update)
This seems to be a vc-mode
issue, but as I detected it with diff-hl-mode I just report it here.
When I run the problematic command I get this
So it seems there is something malformed with it? And it is related with: #117
This is with the master branch of emacs.
Seems like, somehow, the buffer is detected as belonging to a Git backend, but there is no Git repository there?
Is that correct?
The file is in a directory where there is git. But in home (where I call emacs) there is not. Actually the directory .config/emacs is a link to a git repo.
Perhaps a different value of vc-follow-symlinks
will make it work?
Perhaps a different value of
vc-follow-symlinks
will make it work?
In my system it is t
Ok. Could you verify that M-x vc-diff
works in those buffers?
Ok. Could you verify that
M-x vc-diff
works in those buffers?
Yes it works. Actually diff-hl
seems to work fine. I only get this error at the beginning, but everything else seems to work fine after that.
"At the beginning", does that mean it happens when every buffer from that project is opened, or just once at some point (with init.el
)?
or just once at some point
just once at some point during the initialization (with init.el) and when it has diffs.
When the file has no changes (diffs) I don't get the error.
When: C-x C-f other-file-in-same-dir
I don't get any error either.
When emacs
+ C-x C-f .config/emacs.d/init.el
there is no error either.
just once at some point during the initialization (with init.el) and when it has diffs
That's a good news, but still I'd like to try to avoid the problem.
Could you post the full backtrace? The one you produced in the first message cuts off at (diff-hl-update)
.
Debugger entered--Lisp error: (error "Failed (status 128): git --no-pager diff-index --e...")
(error "Failed (%s): %s" "status 128" "git --no-pager diff-index --exit-code -U0 -p 4b825...")
(vc-do-command " *diff-hl* " 1 "git" ("/home/ergo/.config/emacs/init.el") "--no-pager" "diff-index" "--exit-code" "-U0" "-p" "4b825dc642cb6eb9a060e54bf8d69288fbee4904" nil "--")
(vc-git-command " *diff-hl* " 1 ("/home/ergo/.config/emacs/init.el") "diff-index" "--exit-code" "-U0" "-p" "4b825dc642cb6eb9a060e54bf8d69288fbee4904" nil "--")
(vc-git-diff ("/home/ergo/.config/emacs/init.el") "4b825dc642cb6eb9a060e54bf8d69288fbee4904" nil " *diff-hl* " nil)
(apply vc-git-diff (("/home/ergo/.config/emacs/init.el") "4b825dc642cb6eb9a060e54bf8d69288fbee4904" nil " *diff-hl* "))
(vc-call-backend Git diff ("/home/ergo/.config/emacs/init.el") "4b825dc642cb6eb9a060e54bf8d69288fbee4904" nil " *diff-hl* ")
(diff-hl-diff-against-reference "/home/ergo/.config/emacs/init.el" Git " *diff-hl* ")
(diff-hl-changes-buffer "/home/ergo/.config/emacs/init.el" Git)
(diff-hl-changes)
(diff-hl-update)
(cond (diff-hl-mode (diff-hl-margin-local-mode (if diff-hl-margin-mode 1 -1)) (diff-hl-update)) (diff-hl-dired-mode (diff-hl-margin-local-mode (if diff-hl-margin-mode 1 -1)) (diff-hl-dired-update)))
(save-current-buffer (set-buffer buf) (cond (diff-hl-mode (diff-hl-margin-local-mode (if diff-hl-margin-mode 1 -1)) (diff-hl-update)) (diff-hl-dired-mode (diff-hl-margin-local-mode (if diff-hl-margin-mode 1 -1)) (diff-hl-dired-update))))
(let ((buf (car --dolist-tail--))) (save-current-buffer (set-buffer buf) (cond (diff-hl-mode (diff-hl-margin-local-mode (if diff-hl-margin-mode 1 -1)) (diff-hl-update)) (diff-hl-dired-mode (diff-hl-margin-local-mode (if diff-hl-margin-mode 1 -1)) (diff-hl-dired-update)))) (setq --dolist-tail-- (cdr --dolist-tail--)))
(while --dolist-tail-- (let ((buf (car --dolist-tail--))) (save-current-buffer (set-buffer buf) (cond (diff-hl-mode (diff-hl-margin-local-mode (if diff-hl-margin-mode 1 -1)) (diff-hl-update)) (diff-hl-dired-mode (diff-hl-margin-local-mode (if diff-hl-margin-mode 1 -1)) (diff-hl-dired-update)))) (setq --dolist-tail-- (cdr --dolist-tail--))))
(let ((--dolist-tail-- (buffer-list))) (while --dolist-tail-- (let ((buf (car --dolist-tail--))) (save-current-buffer (set-buffer buf) (cond (diff-hl-mode (diff-hl-margin-local-mode (if diff-hl-margin-mode 1 -1)) (diff-hl-update)) (diff-hl-dired-mode (diff-hl-margin-local-mode (if diff-hl-margin-mode 1 -1)) (diff-hl-dired-update)))) (setq --dolist-tail-- (cdr --dolist-tail--)))))
(let ((last-message (current-message))) (progn (set-default 'diff-hl-margin-mode (cond ((eq arg 'toggle) (not (default-value 'diff-hl-margin-mode))) ((and (numberp arg) (< arg 1)) nil) (t t)))) (if (boundp 'global-minor-modes) (progn (setq global-minor-modes (delq 'diff-hl-margin-mode global-minor-modes)) (if (default-value 'diff-hl-margin-mode) (progn (setq global-minor-modes (cons 'diff-hl-margin-mode global-minor-modes)))))) (if diff-hl-margin-mode (progn (add-hook 'diff-hl-mode-on-hook 'diff-hl-margin-local-mode) (add-hook 'diff-hl-mode-off-hook 'diff-hl-margin-local-mode-off) (add-hook 'diff-hl-dired-mode-on-hook 'diff-hl-margin-local-mode) (add-hook 'diff-hl-dired-mode-off-hook 'diff-hl-margin-local-mode-off)) (remove-hook 'diff-hl-mode-on-hook 'diff-hl-margin-local-mode) (remove-hook 'diff-hl-mode-off-hook 'diff-hl-margin-local-mode-off) (remove-hook 'diff-hl-dired-mode-on-hook 'diff-hl-margin-local-mode) (remove-hook 'diff-hl-dired-mode-off-hook 'diff-hl-margin-local-mode-off)) (let ((--dolist-tail-- (buffer-list))) (while --dolist-tail-- (let ((buf (car --dolist-tail--))) (save-current-buffer (set-buffer buf) (cond (diff-hl-mode (diff-hl-margin-local-mode ...) (diff-hl-update)) (diff-hl-dired-mode (diff-hl-margin-local-mode ...) (diff-hl-dired-update)))) (setq --dolist-tail-- (cdr --dolist-tail--))))) (run-hooks 'diff-hl-margin-mode-hook (if (default-value 'diff-hl-margin-mode) 'diff-hl-margin-mode-on-hook 'diff-hl-margin-mode-off-hook)) (if (called-interactively-p 'any) (progn (customize-mark-as-set 'diff-hl-margin-mode) (if (and (current-message) (not (equal last-message (current-message)))) nil (let ((local "")) (message "Diff-Hl-Margin mode %sabled%s" (if (default-value ...) "en" "dis") local))))))
(diff-hl-margin-mode 1)
(if (display-graphic-p) nil (diff-hl-margin-mode 1))
(unless (display-graphic-p) (diff-hl-margin-mode 1))
(my/diff-hl-mode)
(run-hooks prog-mode-hook)
And the config is:
(use-package diff-hl :defer t
:preface
(defun my/diff-hl-mode ()
(turn-on-diff-hl-mode)
(unless (display-graphic-p)
(diff-hl-margin-mode 1)))
:init
(setq-default diff-hl-disable-on-remote t)
(add-hook 'prog-mode-hook #'my/diff-hl-mode)
(add-hook 'vc-dir-mode-hook #'my/diff-hl-mode)
(add-hook 'dired-mode-hook #'diff-hl-dired-mode-unless-remote)
:config
;; Add the hook only after the package is loaded because they are not autoloads.
(add-hook 'magit-pre-refresh-hook #'diff-hl-magit-pre-refresh)
(add-hook 'magit-post-refresh-hook #'diff-hl-magit-post-refresh))
Thanks.
(run-hooks prog-mode-hook)
Is that the beginning? Where does this call to run-hooks
come from?
Let me know if happens again.