summaryrefslogtreecommitdiff
path: root/src/gitget/gitget
diff options
context:
space:
mode:
Diffstat (limited to 'src/gitget/gitget')
-rwxr-xr-xsrc/gitget/gitget28
1 files changed, 14 insertions, 14 deletions
diff --git a/src/gitget/gitget b/src/gitget/gitget
index 6a4b9d1..5e0c125 100755
--- a/src/gitget/gitget
+++ b/src/gitget/gitget
@@ -1,7 +1,7 @@
#!/usr/bin/env bash
# Copyright (C) 2012-2013 Pacman Development Team <pacman-dev@archlinux.org>
-# Copyright (C) 2012-2013 Luke Shumaker <lukeshu@sbcglobal.net>
+# Copyright (C) 2012-2013, 2017 Luke Shumaker <lukeshu@sbcglobal.net>
#
# License: GNU GPLv2+
#
@@ -34,7 +34,7 @@ cd_safe() {
if ! cd "$1"; then
error "Failed to change to directory %s" "$1"
plain "Aborting..."
- exit 1
+ exit $EXIT_FAILURE
fi
}
@@ -51,7 +51,7 @@ download_git_checkout() {
if ! git clone "$url" "$dir"; then
error "Failure while downloading %s %s repo" "${name}" "git"
plain "Aborting..."
- exit 1
+ exit $EXIT_FAILURE
fi
cd_safe "$dir"
if [[ -n $push ]]; then
@@ -67,7 +67,7 @@ download_git_checkout() {
else
error "%s is not a clone of %s" "$dir" "$url"
plain "Aborting..."
- exit 1
+ exit $EXIT_FAILURE
fi
fi
if [[ -n $push ]] ; then
@@ -78,11 +78,11 @@ download_git_checkout() {
if ! curpush="$(git config --get remote.origin.pushUrl)"; then
error "%s does not have a %s configured" pushUrl "$name"
plain "Aborting..."
- exit 1
+ exit $EXIT_FAILURE
elif [[ $curpush != "$push" ]]; then
error "%s has %s configured, but it doesn't match %s" "$name" pushUrl "$push"
plain "Aborting..."
- exit 1
+ exit $EXIT_FAILURE
fi
fi
fi
@@ -106,7 +106,7 @@ download_git_bare() {
if ! git clone --mirror "$url" "$dir"; then
error "Failure while downloading %s %s repo" "${name}" "git"
plain "Aborting..."
- exit 1
+ exit $EXIT_FAILURE
fi
if [[ -n $push ]]; then
cd_safe "$dir"
@@ -121,7 +121,7 @@ download_git_bare() {
else
error "%s is not a clone of %s" "$dir" "$url"
plain "Aborting..."
- exit 1
+ exit $EXIT_FAILURE
fi
fi
if [[ -n $push ]] ; then
@@ -132,11 +132,11 @@ download_git_bare() {
if ! curpush="$(git config --get remote.origin.pushUrl)"; then
error "%s does not have a %s configured" pushUrl "$name"
plain "Aborting..."
- exit 1
+ exit $EXIT_FAILURE
elif [[ $curpush != "$push" ]]; then
error "%s has %s configured, but it doesn't match %s" "$name" pushUrl "$push"
plain "Aborting..."
- exit 1
+ exit $EXIT_FAILURE
fi
fi
fi
@@ -192,12 +192,12 @@ main() {
f) FORCE=true;;
p) push=$OPTARG;;
n) name=$OPTARG;;
- h) usage; return 0;;
- *) usage >&2; return 1;;
+ h) usage; exit $EXIT_SUCCESS;;
+ *) usage >&2; exit $EXIT_INVALIDARGUMENT;;
esac
done
shift $((OPTIND - 1))
- [[ $# == 3 ]] || { usage >&2; return 1; }
+ [[ $# == 3 ]] || { usage >&2; exit $EXIT_INVALIDARGUMENT; }
local mode=$1
local url=${2#git+}
local dir=$3
@@ -218,7 +218,7 @@ main() {
case "$mode" in
checkout) download_git_checkout "$urlmain" "$ref" "$dir" "$name" "$push";;
bare) download_git_bare "$urlmain" "$dir" "$name" "$push";;
- *) usage >&2; return 1;;
+ *) usage >&2; exit $EXIT_INVALIDARGUMENT;;
esac
}