branch: master commit b4492a301ac00b5aefbcdf89ae36924055e4256d Author: Hans Jerry Illikainen <h...@dyntopia.com> Commit: Hans Jerry Illikainen <h...@dyntopia.com>
counsel.el (counsel-git-checkout-action): Quote branch names Quoting branch names is necessary to avoid executing shell substitutions. Fixes #1905. --- counsel.el | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/counsel.el b/counsel.el index ee78d9f..af83039 100644 --- a/counsel.el +++ b/counsel.el @@ -1694,7 +1694,9 @@ The command is passed a single argument comprising all characters in BRANCH up to, but not including, the first space character (#x20), or the string's end if it lacks a space." (shell-command - (format "git checkout %s" (substring branch 0 (string-match-p " " branch))))) + (format "git checkout %s" + (shell-quote-argument + (substring branch 0 (string-match-p " " branch)))))) (defun counsel-git-branch-list () "Return list of branches in the current git repository.