xref: /JGit/org.eclipse.jgit.pgm/jgit.sh (revision df81c56524e578f569ea12854526c1461ac6e42d)
1dad52baaSShawn O. Pearce#!/bin/sh
2dad52baaSShawn O. Pearce# Copyright (C) 2008-2009, Google Inc.
3dad52baaSShawn O. Pearce# Copyright (C) 2008, Shawn O. Pearce <spearce@spearce.org>
4dad52baaSShawn O. Pearce# and other copyright owners as documented in the project's IP log.
5dad52baaSShawn O. Pearce#
6dad52baaSShawn O. Pearce# This program and the accompanying materials are made available
7dad52baaSShawn O. Pearce# under the terms of the Eclipse Distribution License v1.0 which
8dad52baaSShawn O. Pearce# accompanies this distribution, is reproduced below, and is
9dad52baaSShawn O. Pearce# available at http://www.eclipse.org/org/documents/edl-v10.php
10dad52baaSShawn O. Pearce#
11dad52baaSShawn O. Pearce# All rights reserved.
12dad52baaSShawn O. Pearce#
13dad52baaSShawn O. Pearce# Redistribution and use in source and binary forms, with or
14dad52baaSShawn O. Pearce# without modification, are permitted provided that the following
15dad52baaSShawn O. Pearce# conditions are met:
16dad52baaSShawn O. Pearce#
17dad52baaSShawn O. Pearce# - Redistributions of source code must retain the above copyright
18dad52baaSShawn O. Pearce#   notice, this list of conditions and the following disclaimer.
19dad52baaSShawn O. Pearce#
20dad52baaSShawn O. Pearce# - Redistributions in binary form must reproduce the above
21dad52baaSShawn O. Pearce#   copyright notice, this list of conditions and the following
22dad52baaSShawn O. Pearce#   disclaimer in the documentation and/or other materials provided
23dad52baaSShawn O. Pearce#   with the distribution.
24dad52baaSShawn O. Pearce#
25dad52baaSShawn O. Pearce# - Neither the name of the Eclipse Foundation, Inc. nor the
26dad52baaSShawn O. Pearce#   names of its contributors may be used to endorse or promote
27dad52baaSShawn O. Pearce#   products derived from this software without specific prior
28dad52baaSShawn O. Pearce#   written permission.
29dad52baaSShawn O. Pearce#
30dad52baaSShawn O. Pearce# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
31dad52baaSShawn O. Pearce# CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
32dad52baaSShawn O. Pearce# INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
33dad52baaSShawn O. Pearce# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
34dad52baaSShawn O. Pearce# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
35dad52baaSShawn O. Pearce# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
36dad52baaSShawn O. Pearce# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
37dad52baaSShawn O. Pearce# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
38dad52baaSShawn O. Pearce# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
39dad52baaSShawn O. Pearce# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
40dad52baaSShawn O. Pearce# STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
41dad52baaSShawn O. Pearce# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
42dad52baaSShawn O. Pearce# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
43dad52baaSShawn O. Pearce
440a39fb2aSShawn O. Pearcecmd=
450a39fb2aSShawn O. Pearcefor a in "$@"
460a39fb2aSShawn O. Pearcedo
470a39fb2aSShawn O. Pearce	case "$a" in
480a39fb2aSShawn O. Pearce	-*) continue ;;
490a39fb2aSShawn O. Pearce	*)  cmd=$a; break; ;;
500a39fb2aSShawn O. Pearce	esac
510a39fb2aSShawn O. Pearcedone
520a39fb2aSShawn O. Pearce
530a39fb2aSShawn O. Pearceuse_pager=
540a39fb2aSShawn O. Pearcecase "$cmd" in
55a5f5b20dSShawn O. Pearceblame)    use_pager=1 ;;
560a39fb2aSShawn O. Pearcediff)     use_pager=1 ;;
570a39fb2aSShawn O. Pearcelog)      use_pager=1 ;;
580a39fb2aSShawn O. Pearceesac
59dad52baaSShawn O. Pearce
60dad52baaSShawn O. Pearcethis_script=`which "$0" 2>/dev/null`
61dad52baaSShawn O. Pearce[ $? -gt 0 -a -f "$0" ] && this_script="$0"
62dad52baaSShawn O. Pearcecp=$this_script
63dad52baaSShawn O. Pearce
64145b1bf0SChristian Halstrickplatform="`uname`"
65dad52baaSShawn O. Pearceif [ -n "$JGIT_CLASSPATH" ]
66dad52baaSShawn O. Pearcethen
67145b1bf0SChristian Halstrick	cp_sep=:
68145b1bf0SChristian Halstrick	# On Windows & MingW use ";" to separate classpath entries
69145b1bf0SChristian Halstrick	[ "${platform#MINGW}" != "$platform" ] && cp_sep=";"
70145b1bf0SChristian Halstrick	cp="$cp$cp_sep$JGIT_CLASSPATH"
71dad52baaSShawn O. Pearcefi
72dad52baaSShawn O. Pearce
73dad52baaSShawn O. Pearce# Cleanup paths for Cygwin.
74dad52baaSShawn O. Pearce#
75145b1bf0SChristian Halstrickcase "$platform" in
76dad52baaSShawn O. PearceCYGWIN*)
77dad52baaSShawn O. Pearce	cp=`cygpath --windows --mixed --path "$cp"`
78dad52baaSShawn O. Pearce	;;
79dad52baaSShawn O. PearceDarwin)
800a39fb2aSShawn O. Pearce	if [ -e /System/Library/Frameworks/JavaVM.framework ]
81dad52baaSShawn O. Pearce	then
82*df81c565SMatthias Sohn		java_args+='
83dad52baaSShawn O. Pearce			-Dcom.apple.mrj.application.apple.menu.about.name=JGit
84dad52baaSShawn O. Pearce			-Dcom.apple.mrj.application.growbox.intrudes=false
85dad52baaSShawn O. Pearce			-Dapple.laf.useScreenMenuBar=true
86dad52baaSShawn O. Pearce			-Xdock:name=JGit
879ffbe444SRobin Rosenberg			-Dfile.encoding=UTF-8
88dad52baaSShawn O. Pearce		'
89dad52baaSShawn O. Pearce	fi
90dad52baaSShawn O. Pearce	;;
91dad52baaSShawn O. Pearceesac
92dad52baaSShawn O. Pearce
93dad52baaSShawn O. PearceCLASSPATH="$cp"
94dad52baaSShawn O. Pearceexport CLASSPATH
95dad52baaSShawn O. Pearce
96dad52baaSShawn O. Pearcejava=java
970a39fb2aSShawn O. Pearceif [ -n "$JAVA_HOME" ]
98dad52baaSShawn O. Pearcethen
99dad52baaSShawn O. Pearce	java="$JAVA_HOME/bin/java"
100dad52baaSShawn O. Pearcefi
101dad52baaSShawn O. Pearce
1020a39fb2aSShawn O. Pearceif [ -n "$use_pager" ]
1030a39fb2aSShawn O. Pearcethen
1040a39fb2aSShawn O. Pearce	use_pager=${GIT_PAGER:-${PAGER:-less}}
1050a39fb2aSShawn O. Pearce	[ cat = "$use_pager" ] && use_pager=
1060a39fb2aSShawn O. Pearcefi
1070a39fb2aSShawn O. Pearce
1080a39fb2aSShawn O. Pearceif [ -n "$use_pager" ]
1090a39fb2aSShawn O. Pearcethen
1100a39fb2aSShawn O. Pearce	LESS=${LESS:-FSRX}
1110a39fb2aSShawn O. Pearce	export LESS
1120a39fb2aSShawn O. Pearce
113137e91a4SMedha Bhargav Prabhala	"$java" $java_args org.springframework.boot.loader.JarLauncher "$@" | $use_pager
1140a39fb2aSShawn O. Pearce	exit
1150a39fb2aSShawn O. Pearceelse
116137e91a4SMedha Bhargav Prabhala  exec "$java" $java_args org.springframework.boot.loader.JarLauncher "$@"
117dad52baaSShawn O. Pearce  exit 1
1180a39fb2aSShawn O. Pearcefi
119