dimitri/el-get — Issue #524: Add *useful* "el-get-revision" command for showing git revision of running el-get
Author: DarwinAwardWinner
Created: 2012-01-31 04:26:58+00:00
State: open

I came up with a simple function that returns the SHA1 of the git commit that is running on a user's emacs:

(defun el-get-revision ()
(with-temp-buffer
(cd (el-get-package-directory "el-get"))
(let* ((args '("git" "show-ref" "HEAD"))
(cmd (mapconcat 'shell-quote-argument args " "))
(output (shell-command-to-string cmd))
(hash (and (string-match "^[[:space:]]*\\([^[:space:]]+\\)" output)
(match-string 0 output))))

However, in its current form, the user would have to do something like type `(el-get-revision)` and then `C-j` in the scratch buffer and copy-paste the result into their bug report, which is kind of inconvenient. Need to work on that.