# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+cmd=
+for a in "$@"
+do
+ case "$a" in
+ -*) continue ;;
+ *) cmd=$a; break; ;;
+ esac
+done
+
+use_pager=
+case "$cmd" in
+diff) use_pager=1 ;;
+log) use_pager=1 ;;
+esac
this_script=`which "$0" 2>/dev/null`
[ $? -gt 0 -a -f "$0" ] && this_script="$0"
cp=`cygpath --windows --mixed --path "$cp"`
;;
Darwin)
- if test -e /System/Library/Frameworks/JavaVM.framework
+ if [ -e /System/Library/Frameworks/JavaVM.framework ]
then
java_args='
-Dcom.apple.mrj.application.apple.menu.about.name=JGit
export CLASSPATH
java=java
-if test -n "$JAVA_HOME"
+if [ -n "$JAVA_HOME" ]
then
java="$JAVA_HOME/bin/java"
fi
-exec "$java" $java_args org.eclipse.jgit.pgm.Main "$@"
-exit 1
+if [ -n "$use_pager" ]
+then
+ use_pager=${GIT_PAGER:-${PAGER:-less}}
+ [ cat = "$use_pager" ] && use_pager=
+fi
+
+if [ -n "$use_pager" ]
+then
+ LESS=${LESS:-FSRX}
+ export LESS
+
+ "$java" $java_args org.eclipse.jgit.pgm.Main "$@" | $use_pager
+ exit
+else
+ exec "$java" $java_args org.eclipse.jgit.pgm.Main "$@"
+ exit 1
+fi