Skip to content

Commit

Permalink
Workaround for broken format on Windows (#9)
Browse files Browse the repository at this point in the history
- Make OS detection logic more POSIX-ish
- Add CYGWIN and CYGWIN Windows variants
daniel-liuzzi authored and paulirish committed Sep 12, 2016
1 parent b0cca78 commit d45fb14
Showing 1 changed file with 21 additions and 4 deletions.
25 changes: 21 additions & 4 deletions git-recent
Original file line number Diff line number Diff line change
@@ -6,11 +6,28 @@
## list all local branches, sorted by last commit, formatted reall purdy
##

# Windows needs more basic format (#8, git-for-windows/git#865)
case $(uname -s) in
CYGWIN*|MINGW32*|MSYS*)
branch='%(refname:short)'
spacer=' '
;;
*)
branch='%(color:yellow)%(refname:short)%(color:reset)'
spacer='%(color:black) %(color:reset)'
;;
esac

format="\
%(HEAD) %(color:yellow)%(refname:short)%(color:reset)|\
%(color:bold red)%(objectname:short) %(color:bold green)(%(committerdate:relative)) %(color:blue)%(authorname) %(color:reset)%(color:yellow)%(upstream:track)%0a\
%(color:black) %(color:reset)|%(contents:subject)%0a\
|"
%(HEAD) \
$branch|\
%(color:bold red)%(objectname:short)%(color:reset) \
%(color:bold green)(%(committerdate:relative))%(color:reset) \
%(color:bold blue)%(authorname)%(color:reset) \
%(color:yellow)%(upstream:track)%(color:reset)
$spacer|\
%(contents:subject)
$spacer|"

lessopts="--tabs=4 --quit-if-one-screen --RAW-CONTROL-CHARS --no-init"

0 comments on commit d45fb14

Please sign in to comment.