branch: externals/agitate commit 8459e26050046ca7dd48528db1c1e0511c1661a7 Author: Protesilaos Stavrou <i...@protesilaos.com> Commit: Protesilaos Stavrou <i...@protesilaos.com>
Add helper prompt for commit log completion --- agitate.el | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/agitate.el b/agitate.el index 9ca24f4b5d..f4bdd0f4db 100644 --- a/agitate.el +++ b/agitate.el @@ -265,6 +265,20 @@ to the text at point." (when (string-match "\\b\\([0-9a-z]+\\) " string) (match-string 1 string))) +(defun agitate--vc-git-commit-prompt (&optional file) + "Prompt for Git commit and return it as a string. +With optional FILE, limit the commits to those pertinent to it." + (let ((default-directory (vc-root-dir))) + (if file + (completing-read + (format "Select revision of `%s': " file) + (process-lines vc-git-program "log" "--oneline" file) + nil t) + (completing-read + "Select revision: " + (process-lines vc-git-program "log" "--oneline" "--") + nil t)))) + ;;;###autoload (defun agitate-vc-git-grep (regexp) "Run `git-grep(1)' for REGEXP in `vc-root-dir'.