Can not apply stash on Windows #522

Closed
pashinin opened this Issue Jan 2, 2013 · 7 comments

Projects

None yet

3 participants

@pashinin
pashinin commented Jan 2, 2013

Happens on Windows 7x64

It can list stashes, but when you apply one with "a" you have this:

$ git --no-pager stash apply stash@{0}
fatal: ambiguous argument 'stash@0': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions

It just destroys "{" "}".

@pashinin
pashinin commented Jan 3, 2013

I tried to escape them

(defadvice magit-run-git (before magit-run-git-win-curly-braces (&rest args) activate)
"Escape {} on Windows"
(setq args '("stash" "apply" "stash@{0}"))
)

But that didn't work:
$ git --no-pager stash apply stash@{0}
fatal: ambiguous argument 'stash@0': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions

@pashinin
pashinin commented Jan 3, 2013

If I can help someone with a dirty solution:

(if (eq system-type 'windows-nt)
(defadvice magit-run-git (before magit-run-git-win-curly-braces (&rest args) activate)
"Escape {} on Windows"
(setcar (nthcdr 2 args)
(replace-regexp-in-string "{\([0-9]+\)}" "\\{\1\\}" (elt args 2)))
)
)

@tarsius
Member
tarsius commented Jun 23, 2013

Can someone else who uses Windows reproduce this?

@tarsius
Member
tarsius commented Jul 6, 2013

Are you still experiencing this?

@pashinin
pashinin commented Jul 7, 2013

Can't say now, I stopped using Emacs on Windows. I'm on Linux most of the time =)
Think you might close it if nobody responds.

@tarsius
Member
tarsius commented Jul 7, 2013

Good for you :-)
I will leave it open for a little longer, but not much.

@tarsius tarsius closed this Jul 12, 2013
@pashinin
pashinin commented Aug 6, 2013

I confirm - this bug still exists.
Maybe I'll make a pull request. But this helped me again:

(if (eq system-type 'windows-nt)
    (defadvice magit-run-git (before magit-run-git-win-curly-braces (&rest args) activate)
      "Escape {} on Windows"
      (setcar (nthcdr 2 args)
              (replace-regexp-in-string "{\\([0-9]+\\)}" "\\\\{\\1\\\\}" (elt args 2)))
      ))

to fix this error on applying stash:

$ git --no-pager stash apply stash@{0}
fatal: ambiguous argument 'stash@0': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions
@vanicat vanicat reopened this Aug 6, 2013
@tarsius tarsius closed this Aug 17, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment