From ba1be17205d3a62e0b7bab881b1d5b772928a7c7 Mon Sep 17 00:00:00 2001 From: Giuseppe Bilotta Date: Thu, 19 Feb 2009 02:48:52 +0100 Subject: [PATCH] support tig in view If $DISPLAY is not set or gitk could not be found, try tig instead, and complain if it can't be found either. --- zit | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/zit b/zit index 44caeb5..449246c 100755 --- a/zit +++ b/zit @@ -33,7 +33,7 @@ zit_help() { ;; view) echo "usage: zit view FILE" - echo "Browse FILE's history with gitk" + echo "Browse FILE's history with gitk (if possible) or tig." ;; with) echo "usage: zit with FILE COMMAND..." @@ -51,7 +51,7 @@ zit_help() { echo " list Synonym for tracked" echo " track Start tracking changes to FILE" echo " tracked List tracked files in current directory" - echo " view Browse FILE's history with gitk" + echo " view Browse FILE's history with gitk or tig" echo " with Run a command in FILE's context" echo "" echo "See 'zit help git' or 'git help' for git commands." @@ -171,7 +171,13 @@ case $cmd in view) zit_setup $1 shift - gitk "$@" + if test -n "$DISPLAY" -a -n "$(which gitk)" ; then + gitk "$@" + elif test -n "$(which tig)" ; then + tig "$@" + else + abort "Neither gitk or tig could be launched" + fi ;; with) zit_setup $1 -- 2.32.0.93.g670b81a890