Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fix switching branches with no stash.

If you don't have any stashes, `.git/refs/stash` won't exist, so feeding
"refs/stash" into git-log gives an ugly error.  Since this was the last
thing that happened in feature-switch, it didn't cause any technical problems,
but it looked ugly.

Fixes #42.
  • Loading branch information...
commit f119f7cde43db22328a4f5199d27bcd0644d7739 1 parent 70fec6d
@xiongchiamiov xiongchiamiov authored
Showing with 5 additions and 0 deletions.
  1. +5 −0 git.rb
5 git.rb
@@ -127,6 +127,11 @@ def self.show_branch_list(options = {})
def self.stashes
+ # Do we even have a stash?
+ if ! File.exist? '.git/refs/stash'
+ return []
+ end
# format = "relative date|stash ref|commit message"
`git log --format="%ar|%gd|%s" -g "refs/stash"` do |line|
fields = line.split '|', 3
Please sign in to comment.
Something went wrong with that request. Please try again.