From 2963de6540a1dc57399eaf530d8e12c794137a84 Mon Sep 17 00:00:00 2001 From: Juri Linkov Date: Wed, 10 Nov 2021 20:41:19 +0200 Subject: [PATCH] * lisp/vc/vc-git.el (vc-git-mergebase): More meaningful error message. Display a readable error message instead of signaling an error on nil value. --- lisp/vc/vc-git.el | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lisp/vc/vc-git.el b/lisp/vc/vc-git.el index 3f89fad2351..2d35061b269 100644 --- a/lisp/vc/vc-git.el +++ b/lisp/vc/vc-git.el @@ -1256,7 +1256,10 @@ log entries." (defun vc-git-mergebase (rev1 &optional rev2) (unless rev2 (setq rev2 "HEAD")) - (string-trim-right (vc-git--run-command-string nil "merge-base" rev1 rev2))) + (let ((base (vc-git--run-command-string nil "merge-base" rev1 rev2))) + (if base + (string-trim-right base) + (error "No common ancestor for merge base")))) (defvar log-view-message-re) (defvar log-view-file-re) -- 2.39.2