"Prompt for an stg command to execute in a shell.
The names of any marked patches or the patch at point are
inserted in the command to be executed.
"Prompt for an stg command to execute in a shell.
The names of any marked patches or the patch at point are
inserted in the command to be executed.
If the command ends in an ampersand, run it asynchronously.
When the command has finished, reload the stgit buffer."
If the command ends in an ampersand, run it asynchronously.
When the command has finished, reload the stgit buffer."
(stgit-assert-mode)
(let* ((patches (stgit-sort-patches
(stgit-patches-marked-or-at-point nil 'allow-committed)))
(patch-names (mapcar 'symbol-name patches))
(hyphens (find-if (lambda (s) (string-match "^-" s)) patch-names))
(defaultcmd (if patches
(stgit-assert-mode)
(let* ((patches (stgit-sort-patches
(stgit-patches-marked-or-at-point nil 'allow-committed)))
(patch-names (mapcar 'symbol-name patches))
(hyphens (find-if (lambda (s) (string-match "^-" s)) patch-names))
(defaultcmd (if patches