- (let ((inserted-index (not stgit-show-worktree))
- index-node
- worktree-node
- all-patchsyms)
- (with-temp-buffer
- (let* ((standard-output (current-buffer))
- (exit-status (stgit-run-silent "series"
- "--description" "--empty")))
- (goto-char (point-min))
- (if (not (zerop exit-status))
- (cond ((looking-at "stg series: \\(.*\\)")
- (setq inserted-index t)
- (ewoc-set-hf ewoc (car (ewoc-get-hf ewoc))
- (substitute-command-keys
- "-- not initialized; run \\[stgit-init]")))
- ((looking-at ".*")
- (error "Error running stg: %s"
- (match-string 0))))
- (while (not (eobp))
- (unless (looking-at
- "\\([0 ]\\)\\([>+-]\\)\\( \\)\\([^ ]+\\) *[|#] \\(.*\\)")
- (error "Syntax error in output from stg series"))
- (let* ((state-str (match-string 2))
- (state (cond ((string= state-str ">") 'top)
- ((string= state-str "+") 'applied)
- ((string= state-str "-") 'unapplied)))
- (name (intern (match-string 4)))
- (desc (match-string 5))
- (empty (string= (match-string 1) "0")))
- (unless inserted-index
- (when (or (eq stgit-show-worktree-mode 'top)
- (and (eq stgit-show-worktree-mode 'center)
- (eq state 'unapplied)))
- (setq inserted-index t)
- (stgit-run-series-insert-index ewoc)))
- (setq all-patchsyms (cons name all-patchsyms))
- (ewoc-enter-last ewoc
- (make-stgit-patch
- :status state
- :name name
- :desc desc
- :empty empty)))
- (forward-line 1))))
+ (let (all-patchsyms)
+ (when stgit-show-committed
+ (let* ((base (stgit-id "{base}"))
+ (range (format "%s~%d..%s" base stgit-committed-count base)))
+ (with-temp-buffer
+ (let* ((standard-output (current-buffer))
+ (fmt (stgit-line-format))
+ (commit-abbrev (when (string-match "%-\\([0-9]+\\)n" fmt)
+ (list (format "--abbrev=%s"
+ (match-string 1 fmt)))))
+ (exit-status (apply 'stgit-run-git-silent
+ "--no-pager"
+ "log" "--reverse" "--pretty=oneline"
+ "--abbrev-commit"
+ `(,@commit-abbrev
+ ,range))))
+ (goto-char (point-min))
+ (if (not (zerop exit-status))
+ (message "Failed to run git log")
+ (while (not (eobp))
+ (unless (looking-at
+ "\\([0-9a-f]+\\)\\(\\.\\.\\.\\)? \\(.*\\)")
+ (error "Syntax error in output from git log"))
+ (let* ((state 'committed)
+ (name (intern (match-string 1)))
+ (desc (match-string 3))
+ (empty nil))
+ (setq all-patchsyms (cons name all-patchsyms))
+ (ewoc-enter-last ewoc
+ (make-stgit-patch
+ :status state
+ :name name
+ :desc desc
+ :empty empty)))
+ (forward-line 1)))))))
+ (let ((inserted-index (not stgit-show-worktree))
+ index-node
+ worktree-node)
+ (with-temp-buffer
+ (let* ((standard-output (current-buffer))
+ (exit-status (stgit-run-silent "series"
+ "--description" "--empty")))
+ (goto-char (point-min))
+ (if (not (zerop exit-status))
+ (cond ((looking-at "stg series: \\(.*\\)")
+ (setq inserted-index t)
+ (ewoc-set-hf ewoc (car (ewoc-get-hf ewoc))
+ (substitute-command-keys
+ "-- not initialized; run \\[stgit-init]")))
+ ((looking-at ".*")
+ (error "Error running stg: %s"
+ (match-string 0))))
+ (while (not (eobp))
+ (unless (looking-at
+ "\\([0 ]\\)\\([>+-]\\)\\( \\)\\([^ ]+\\) *[|#] \\(.*\\)")
+ (error "Syntax error in output from stg series"))
+ (let* ((state-str (match-string 2))
+ (state (cond ((string= state-str ">") 'top)
+ ((string= state-str "+") 'applied)
+ ((string= state-str "-") 'unapplied)))
+ (name (intern (match-string 4)))
+ (desc (match-string 5))
+ (empty (string= (match-string 1) "0")))
+ (unless inserted-index
+ (when (or (eq stgit-show-worktree-mode 'top)
+ (and (eq stgit-show-worktree-mode 'center)
+ (eq state 'unapplied)))
+ (setq inserted-index t)
+ (stgit-run-series-insert-index ewoc)))
+ (setq all-patchsyms (cons name all-patchsyms))
+ (ewoc-enter-last ewoc
+ (make-stgit-patch
+ :status state
+ :name name
+ :desc desc
+ :empty empty)))
+ (forward-line 1)))))