\(This requires at least Git version 1.5.6, for the --graph option.)
If START-REVISION is non-nil, it is the newest revision to show.
If LIMIT is a number, show no more than this many entries.
-If LIMIT is a revision string, use it as an end-revision."
+If LIMIT is a non-empty string, use it as a base."
(let ((coding-system-for-read
(or coding-system-for-read vc-git-log-output-coding-system)))
;; `vc-do-command' creates the buffer, but we need it before running
(vc-setup-buffer buffer)
;; If the buffer exists from a previous invocation it might be
;; read-only.
- (let ((inhibit-read-only t))
+ (let ((inhibit-read-only t)
+ ;; In some parts of Git's revision and revision range
+ ;; notation, an empty string is equivalent to "HEAD", but not
+ ;; everywhere. For simplicity we'll always be explicit.
+ (start-revision (if (member start-revision '(nil ""))
+ "HEAD"
+ start-revision))
+ ;; An empty string LIMIT doesn't make sense given the
+ ;; specification of this VC backend function, and is tricky to
+ ;; deal with in combination with Git's double-dot notation for
+ ;; specifying revision ranges. So discard it right away.
+ (limit (and (not (equal limit ""))
+ limit)))
(with-current-buffer buffer
(apply #'vc-git-command buffer
'async files
(if shortlog vc-git-shortlog-switches vc-git-log-switches))
(when (numberp limit)
(list "-n" (format "%s" limit)))
- (when start-revision
- (if (and limit (not (numberp limit)))
- (list (concat start-revision ".." (if (equal limit "")
- "HEAD"
- limit)))
- (list start-revision)))
(when (eq vc-log-view-type 'with-diff)
(list "-p"))
+ (list (concat (and (stringp limit)
+ (concat limit ".."))
+ start-revision))
'("--")))))))
(defun vc-git-incoming-revision (remote-location)
;; Insert the revision log for FILES into BUFFER.
;; If SHORTLOG is non-nil insert a short version of the log.
;; If LIMIT is non-nil insert only insert LIMIT log entries.
-;; When LIMIT is a string it means stop at that revision.
+;; When LIMIT is a string it means stop right before that revision
+;; (i.e., revision LIMIT itself should not be included in the log).
;; If the backend does not support limiting the number of entries to
;; show it should return `limit-unsupported'.
;; If START-REVISION is given, then show the log starting from that
remote-location)
(user-error "No incoming revision -- local-only branch?"))))
(vc-call-backend backend 'print-log (list rootdir) buffer t
- (vc-call-backend backend 'mergebase incoming)
- incoming))))
+ incoming
+ (vc-call-backend backend 'mergebase incoming)))))
;;;###autoload
(defun vc-log-outgoing (&optional remote-location)
remote-location)
(user-error "No incoming revision -- local-only branch?"))))
(vc-call-backend backend 'print-log (list rootdir) buffer t
- (vc-call-backend backend 'mergebase incoming)
- ""))))
+ ""
+ (vc-call-backend backend 'mergebase incoming)))))
;;;###autoload
(defun vc-log-search (pattern)
(list backend (list (vc-call-backend backend 'root default-directory)))))))
(vc--with-backend-in-rootdir "VC root-log"
(setq rev1 (vc-call-backend backend 'mergebase rev1 rev2))
- (vc-print-log-internal backend (list rootdir) rev1 t (or rev2 ""))))
+ (vc-print-log-internal backend (list rootdir) (or rev2 "") t rev1)))
;;;###autoload
(defun vc-region-history (from to)