Add a rev number to SPC hds.

Describe system information was useless if we don't know which rev.
people are using. This adds this information.
This commit is contained in:
Robert O'Connor 2015-08-20 00:26:26 -04:00 committed by syl20bnr
parent a8582813c0
commit 7da1b876aa
2 changed files with 22 additions and 4 deletions

View File

@ -208,11 +208,28 @@ version and the NEW version."
(kill-buffer proc-buffer))))
(defun spacemacs/git-get-current-branch ()
"Return the current branch. Return nil if an error occurred."
(let((proc-buffer "git-get-current-branch")
"Return the current branch. Return nil if an error occurred."
(let((proc-buffer "git-get-current-branch")
(default-directory (file-truename user-emacs-directory)))
(when (eq 0 (process-file "git" nil proc-buffer nil
"symbolic-ref" "--short" "-q" "HEAD"))
(with-current-buffer proc-buffer
(prog1
(when (buffer-string)
(goto-char (point-min))
(replace-regexp-in-string
"\n$" ""
(buffer-substring (line-beginning-position)
(line-end-position))))
(kill-buffer proc-buffer))))))
(defun spacemacs/git-get-current-branch-rev ()
"Returns the hash of the head commit on the current branch.
Returns nil if an error occurred."
(let((proc-buffer "git-get-current-branch-head-hash")
(default-directory (file-truename user-emacs-directory)))
(when (eq 0 (process-file "git" nil proc-buffer nil
"symbolic-ref" "--short" "-q" "HEAD"))
"rev-parse" "--short" "HEAD"))
(with-current-buffer proc-buffer
(prog1
(when (buffer-string)

View File

@ -249,12 +249,13 @@ FILE-TO-LOAD is an explicit file to load after the installation."
"- OS: %s\n"
"- Emacs: %s\n"
"- Spacemacs: %s\n"
"- Spacemacs branch: %s\n"
"- Spacemacs branch: %s (rev. %s)\n"
"- Layers:\n```elisp\n%s```\n")
system-type
emacs-version
spacemacs-version
(spacemacs/git-get-current-branch)
(spacemacs/git-get-current-branch-rev)
(pp dotspacemacs-configuration-layers))))
(kill-new sysinfo)
(message sysinfo)