diff --git a/libexec/sourcezap/commands/sourcezap-checkout b/libexec/sourcezap/commands/sourcezap-checkout index 91bd050..71713e6 100755 --- a/libexec/sourcezap/commands/sourcezap-checkout +++ b/libexec/sourcezap/commands/sourcezap-checkout @@ -5,6 +5,7 @@ set -e # variables localbase=${LOCALBASE:-$(realpath "$(dirname "$0")"/../../..)} libexec="${localbase}"/libexec/sourcezap +git="${libexec}"/utils/git/run gitdir=$1 branch=$2 @@ -30,6 +31,6 @@ if [ ! -e "${gitdir}/.git" ]; then fi cd "${gitdir}" -git fetch origin -git checkout "${branch}" || git checkout -t origin/"${branch}" +"${git}" fetch origin +"${git}" checkout "${branch}" || "${git}" checkout -t origin/"${branch}" printok "${branch} checked out" diff --git a/libexec/sourcezap/commands/sourcezap-clone b/libexec/sourcezap/commands/sourcezap-clone index 4bb5a51..239f128 100755 --- a/libexec/sourcezap/commands/sourcezap-clone +++ b/libexec/sourcezap/commands/sourcezap-clone @@ -5,6 +5,7 @@ set -e # variables localbase=${LOCALBASE:-$(realpath "$(dirname "$0")"/../../..)} libexec="${localbase}"/libexec/sourcezap +git="${libexec}"/utils/git/run giturl=$1 gitdir=$2 branch=$3 @@ -30,8 +31,8 @@ if [ -e "${gitdir}/.git" ]; then exit 1 fi -git clone "${giturl}" "${gitdir}" +"${git}" clone "${giturl}" "${gitdir}" cd "${gitdir}" -git config core.filemode off -git checkout -t origin/"${branch}" +"${git}" config core.filemode off +"${git}" checkout -t origin/"${branch}" printok "clone complete" diff --git a/libexec/sourcezap/commands/sourcezap-install b/libexec/sourcezap/commands/sourcezap-install index 8b1d23a..c9c618c 100755 --- a/libexec/sourcezap/commands/sourcezap-install +++ b/libexec/sourcezap/commands/sourcezap-install @@ -6,6 +6,7 @@ set -e localbase=${LOCALBASE:-$(realpath "$(dirname "$0")"/../../..)} libexec="${localbase}"/libexec/sourcezap mode=u=rwX,g=rX,o= +git="${libexec}"/utils/git/run gitdir=$1 installdir=$2 revfile=$3 @@ -72,7 +73,7 @@ if [ "$(id -u)" != "0" ]; then exit 1 fi -umask ${mode} +umask "${mode}" cd "${gitdir}" run_install "-d" "${installdir}" chmod ${mode} "${installdir}" @@ -81,5 +82,5 @@ if [ -e "${revfile}" ]; then else perform_install fi -git rev-parse HEAD > "${revfile}" +"${git}" rev-parse HEAD > "${revfile}" printok "install complete" diff --git a/libexec/sourcezap/commands/sourcezap-pull b/libexec/sourcezap/commands/sourcezap-pull index c389e09..a42ae77 100755 --- a/libexec/sourcezap/commands/sourcezap-pull +++ b/libexec/sourcezap/commands/sourcezap-pull @@ -5,6 +5,7 @@ set -e # variables localbase=${LOCALBASE:-$(realpath "$(dirname "$0")"/../../..)} libexec="${localbase}"/libexec/sourcezap +git="${libexec}"/utils/git/run gitdir=$1 ## @@ -30,6 +31,6 @@ if [ ! -e "${gitdir}/.git" ]; then fi cd "${gitdir}" -branch=$(git branch --show-current) -git pull --rebase origin "${branch}" +branch=$("${git}" branch --show-current) +"${git}" pull --rebase origin "${branch}" printok "pull complete" diff --git a/libexec/sourcezap/functions.sh b/libexec/sourcezap/functions.sh index e14a696..603be58 100644 --- a/libexec/sourcezap/functions.sh +++ b/libexec/sourcezap/functions.sh @@ -1,10 +1,5 @@ #!/bin/sh -git() -{ - "${libexec}"/utils/git/run "${@}" -} - printok() { printf "ok: %s\n" "${@}" > /dev/stdout diff --git a/libexec/sourcezap/utils/git/get-changed-files b/libexec/sourcezap/utils/git/get-changed-files index 8d6785d..cfb92be 100755 --- a/libexec/sourcezap/utils/git/get-changed-files +++ b/libexec/sourcezap/utils/git/get-changed-files @@ -5,6 +5,7 @@ set -e # variables localbase=${LOCALBASE:-$(realpath "$(dirname "$0")"/../../../..)} libexec="${localbase}"/libexec/sourcezap +git="${libexec}"/utils/git/run gitdir=$1 commit=$2 @@ -15,5 +16,5 @@ commit=$2 ## # main cd "${gitdir}" -git diff -l0 --name-only --diff-filter=A "${commit}" "HEAD" -git diff -l0 --name-only --diff-filter=M "${commit}" "HEAD" +"${git}" diff -l0 --name-only --diff-filter=A "${commit}" "HEAD" +"${git}" diff -l0 --name-only --diff-filter=M "${commit}" "HEAD" diff --git a/libexec/sourcezap/utils/git/get-removed-files b/libexec/sourcezap/utils/git/get-removed-files index 51ba723..bdfee32 100755 --- a/libexec/sourcezap/utils/git/get-removed-files +++ b/libexec/sourcezap/utils/git/get-removed-files @@ -5,6 +5,7 @@ set -e # variables localbase=${LOCALBASE:-$(realpath "$(dirname "$0")"/../../../..)} libexec="${localbase}"/libexec/sourcezap +git="${libexec}"/utils/git/run gitdir=$1 commit=$2 @@ -15,4 +16,4 @@ commit=$2 ## # main cd "${gitdir}" -git diff -l0 --name-only --diff-filter=D "${commit}" "HEAD" +"${git}" diff -l0 --name-only --diff-filter=D "${commit}" "HEAD"