From 2d96fdc3b7dc63744fe8c4a1a76c10d09d2b2aee Mon Sep 17 00:00:00 2001 From: Sean Whitton Date: Sat, 13 Dec 2025 14:13:15 +0000 Subject: [PATCH] vc-git-dir-status-goto-stage: Accept exit 128 from git-add * lisp/vc/vc-git.el (vc-git-dir-status-goto-stage): Accept an exit code of 128 from 'git add --refresh' (bug#79999). --- lisp/vc/vc-git.el | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/lisp/vc/vc-git.el b/lisp/vc/vc-git.el index ad70202724e..0bcd0bcf1e4 100644 --- a/lisp/vc/vc-git.el +++ b/lisp/vc/vc-git.el @@ -718,12 +718,17 @@ or an empty string if none." (defun vc-git-dir-status-goto-stage (git-state) ;; TODO: Look into reimplementing this using `git status --porcelain=v2'. - (let ((files (vc-git-dir-status-state->files git-state))) + (let ((files (vc-git-dir-status-state->files git-state)) + (allowed-exit 1)) (erase-buffer) (pcase (vc-git-dir-status-state->stage git-state) ('update-index (if files - (vc-git-command (current-buffer) 'async files "add" "--refresh" "--") + (progn (vc-git-command (current-buffer) 'async files + "add" "--refresh" "--") + ;; git-add exits 128 if some of FILES are untracked; + ;; we can ignore that (bug#79999). + (setq allowed-exit 128)) (vc-git-command (current-buffer) 'async nil "update-index" "--refresh"))) ('ls-files-added @@ -749,7 +754,7 @@ or an empty string if none." ('diff-index (vc-git-command (current-buffer) 'async files "diff-index" "--relative" "-z" "-M" "HEAD" "--"))) - (vc-run-delayed-success 1 + (vc-run-delayed-success allowed-exit (vc-git-after-dir-status-stage git-state)))) (defun vc-git-dir-status-files (_dir files update-function)