From d45fb14b7da4a830470696fc58931ca88b6184a2 Mon Sep 17 00:00:00 2001 From: Daniel Liuzzi Date: Tue, 13 Sep 2016 01:11:36 +0200 Subject: [PATCH] Workaround for broken format on Windows (#9) - Make OS detection logic more POSIX-ish - Add CYGWIN and CYGWIN Windows variants --- git-recent | 25 +++++++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-) diff --git a/git-recent b/git-recent index 5b1dfe4..bbb64d5 100755 --- a/git-recent +++ b/git-recent @@ -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"