fix fetch before counting diffs

This commit is contained in:
2021-02-01 12:17:02 +01:00
parent 709325fb3e
commit 3e98c9864e

View File

@@ -424,9 +424,9 @@ Usage:
(remotes (magit-list-remotes))
(diff))
(when (= (length remotes) 1)
(when with-update (magit-git-string "fetch" (car remotes) branch))
(let* ((remote-branch-name (concat (car remotes) "/" branch)) ;; @{u} may not configured, TODO: (if (magit-rev-parse "@{u}") ...)
(diff-count (magit-rev-diff-count "@" remote-branch-name))) ;; i.e. git rev-list @...origin/master --count --left-right
(when with-update (magit-git-string "fetch" (car remotes) branch))
(setq diff (- (cadr diff-count) (car diff-count)))))
(if as-text
(if (= diff 0) "Up-to-date"