summaryrefslogtreecommitdiff
path: root/src/gitget
diff options
context:
space:
mode:
authorLuke Shumaker <lukeshu@lukeshu.com>2017-05-25 14:39:05 -0400
committerLuke Shumaker <lukeshu@lukeshu.com>2017-05-25 17:28:30 -0400
commit6092b9d93df1c3d5170a2b6aa0275aebef18bd37 (patch)
tree55627e026fa7f538f8085f0fb8ed1fffcce4fcbc /src/gitget
parentaedbebb0ea3c7b40dda987b43ff21475ef67f423 (diff)
start moving things to use the libremessages exit codes
Diffstat (limited to 'src/gitget')
-rwxr-xr-xsrc/gitget/gitget28
-rwxr-xr-xsrc/gitget/libregit4
2 files changed, 16 insertions, 16 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
}
diff --git a/src/gitget/libregit b/src/gitget/libregit
index 6c49af5..5b7e799 100755
--- a/src/gitget/libregit
+++ b/src/gitget/libregit
@@ -1,6 +1,6 @@
#!/usr/bin/env bash
-# Copyright (C) 2012-2013 Luke Shumaker <lukeshu@sbcglobal.net>
+# Copyright (C) 2012-2013, 2017 Luke Shumaker <lukeshu@sbcglobal.net>
#
# License: GNU GPLv2+
#
@@ -32,7 +32,7 @@ usage() {
}
main() {
- [[ $# == 3 ]] || { usage >&2; return 1; }
+ [[ $# == 3 ]] || { usage >&2; exit $EXIT_INVALIDARGUMENT; }
repo=$1
ref=$2
dir=$3