summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDave Reisner <dreisner@archlinux.org>2017-04-04 11:29:10 -0400
committerDave Reisner <dreisner@archlinux.org>2017-04-04 11:29:10 -0400
commit2d4a6b2d83dfd61760dfc569265a67fea3249bdb (patch)
tree5f6b9c311de6b373071f44855611218a3e50fa0f
parentccfe1f2e0d55198dcd6b9ed63ec3c60b6008a219 (diff)
downloadasp32-2d4a6b2d83dfd61760dfc569265a67fea3249bdb.tar.xz
avoid leaking git output for completions
completions might trigger tracking of a new package. it all goes to stderr, but let's not crowd the output regardless.
-rw-r--r--package.inc.sh2
-rw-r--r--remote.inc.sh2
-rw-r--r--shell/bash-completion6
-rw-r--r--util.inc.sh8
4 files changed, 13 insertions, 5 deletions
diff --git a/package.inc.sh b/package.inc.sh
index b1d438b..22147de 100644
--- a/package.inc.sh
+++ b/package.inc.sh
@@ -167,7 +167,7 @@ package_checkout() {
git show-ref -q "refs/heads/$remote/packages/$pkgname" ||
git branch -qf --no-track {,}"$remote/packages/$pkgname"
- git clone "$ASPROOT" --single-branch --branch "$remote/packages/$pkgname" \
+ quiet_git clone "$ASPROOT" --single-branch --branch "$remote/packages/$pkgname" \
"$startdir/$pkgname" || return 1
git --git-dir="$startdir/$pkgname/.git" config pull.rebase true
diff --git a/remote.inc.sh b/remote.inc.sh
index 8b9674b..db6d318 100644
--- a/remote.inc.sh
+++ b/remote.inc.sh
@@ -52,7 +52,7 @@ remote_get_tracked_refs() {
remote_update_refs() {
local remote=$1 refspecs=("${@:2}")
- git fetch "$remote" "${refspecs[@]}"
+ quiet_git fetch "$remote" "${refspecs[@]}"
}
remote_update() {
diff --git a/shell/bash-completion b/shell/bash-completion
index 7233705..acff4c8 100644
--- a/shell/bash-completion
+++ b/shell/bash-completion
@@ -39,11 +39,11 @@ _asp() {
word=${COMP_WORDS[i]}
if in_array "$word" ${verbs[ALL_PACKAGES]}; then
verb=$word
- comps=$(\asp list-all | sed 's,.*/,,')
+ comps=$(ASP_GIT_QUIET=1 \asp list-all | sed 's,.*/,,')
break
elif in_array "$word" ${verbs[LOCAL_PACKAGES]}; then
verb=$word
- comps=$(\asp list-local | sed 's,.*/,,')
+ comps=$(ASP_GIT_QUIET=1 \asp list-local | sed 's,.*/,,')
break
elif in_array "$word" ${verbs[NONE]}; then
verb=$word
@@ -55,7 +55,7 @@ _asp() {
case $verb in
show)
if (( i < ${#COMP_WORDS[@]} - 2 )); then
- comps=$(\asp ls-files "${COMP_WORDS[i+1]}" 2>/dev/null)
+ comps=$(ASP_GIT_QUIET=1 \asp ls-files "${COMP_WORDS[i+1]}" 2>/dev/null)
fi
;;
'')
diff --git a/util.inc.sh b/util.inc.sh
index c33cb63..ddd7592 100644
--- a/util.inc.sh
+++ b/util.inc.sh
@@ -36,3 +36,11 @@ in_array() {
return 1
}
+
+quiet_git() {
+ local q
+
+ [[ $ASP_GIT_QUIET ]] && q=('-q')
+
+ command git "$1" "${q[@]}" "${@:2}"
+}