Subject: 24.0.50; (vc-git) stash@{n} - requires shell quoting?

From: Jambunathan K <[email-masked]>
Date: Mon, 12 Sep 2011 12:39:43 +0530

While in a *vc-dir* buffer (backed by git) and trying to show or apply a
stash fails.

I am attaching "works for me" patch that shell-quotes stash@{n}
argument. With this "patch", the stash commands work as expected.

My shell-file-name is set to "bash" (cygwin version). My Emacs is

In GNU Emacs 24.0.50.1 (i386-mingw-nt5.1.2600)
 of 2011-09-06 on 3249CTO
Windowing system distributor `Microsoft Corp.', version 5.1.2600
configured using `configure --with-gcc (4.5) --no-opt'

Additional Info:

,----
| VC backend : Git
| Working dir: ~/src/org-mode/
| Branch     : master
| Remote     : [email-masked]:org-mode.git
| Stash      :
|              {0}: On master: custom tables  <-----
`----

FWIW, the stash line has following keymap:

,----
| (keymap
|  (83 . vc-git-stash-snapshot)
|  (80 . vc-git-stash-pop-at-point)
|  (65 . vc-git-stash-apply-at-point)
|  (13 . vc-git-stash-show-at-point)
|  (61 . vc-git-stash-show-at-point)
|  (11 . vc-git-stash-delete-at-point)
|  (down-mouse-3 . vc-git-stash-menu)
|  (mouse-2 . ignore))
`----

*** a/vc-git.el	Mon Sep 12 12:14:06 2011
--- b/vc-git.el	Mon Sep 12 12:16:41 2011
***************
*** 1066,1085 ****
    (interactive)
    (let ((stash (vc-git-stash-get-at-point (point))))
      (when (y-or-n-p (format "Remove stash %s ? " stash))
!       (vc-git--run-command-string nil "stash" "drop" (format "stash@%s" stash))
        (vc-dir-refresh))))
  
  (defun vc-git-stash-show-at-point ()
    (interactive)
!   (vc-git-stash-show (format "stash@%s" (vc-git-stash-get-at-point (point)))))
  
  (defun vc-git-stash-apply-at-point ()
    (interactive)
!   (vc-git-stash-apply (format "stash@%s" (vc-git-stash-get-at-point (point)))))
  
  (defun vc-git-stash-pop-at-point ()
    (interactive)
!   (vc-git-stash-pop (format "stash@%s" (vc-git-stash-get-at-point (point)))))
  
  (defun vc-git-stash-menu (e)
    (interactive "e")
--- 1066,1093 ----
    (interactive)
    (let ((stash (vc-git-stash-get-at-point (point))))
      (when (y-or-n-p (format "Remove stash %s ? " stash))
!       (vc-git--run-command-string nil "stash" "drop"
! 				  (shell-quote-argument
! 				   (format "stash@%s" stash)))
        (vc-dir-refresh))))
  
  (defun vc-git-stash-show-at-point ()
    (interactive)
!   (vc-git-stash-show
!    (shell-quote-argument
!     (format "stash@%s" (vc-git-stash-get-at-point (point))))))
  
  (defun vc-git-stash-apply-at-point ()
    (interactive)
!   (vc-git-stash-apply
!    (shell-quote-argument
!     (format "stash@%s" (vc-git-stash-get-at-point (point))))))
  
  (defun vc-git-stash-pop-at-point ()
    (interactive)
!   (vc-git-stash-pop
!    (shell-quote-argument
!     (format "stash@%s" (vc-git-stash-get-at-point (point))))))
  
  (defun vc-git-stash-menu (e)
    (interactive "e")