diff options
author | Ben Hutchings <ben@decadent.org.uk> | 2018-06-22 18:32:09 +0100 |
---|---|---|
committer | Ben Hutchings <ben@decadent.org.uk> | 2018-06-22 18:32:09 +0100 |
commit | 22fe893d50f20e67c5cdaba052da24eddd826cba (patch) | |
tree | a2d481b69ee4a0529f4f5e9df217ef84af0af4bf | |
parent | 2226b40faef40d552f0412f775562f5780e44cd3 (diff) | |
download | linux-stable-queue-22fe893d50f20e67c5cdaba052da24eddd826cba.tar.gz |
import-ccd: Factor out yes/no prompt into a function
-rwxr-xr-x | scripts/import-ccd | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/scripts/import-ccd b/scripts/import-ccd index 25a0e8cb..917473e0 100755 --- a/scripts/import-ccd +++ b/scripts/import-ccd @@ -51,6 +51,18 @@ index=0 total="$(wc -l "$STABLE_QUEUES/upstream-commits")" total="${total% *}" +read_user_bool() { + local prompt="$1" + local REPLY + while true; do + read -p "$prompt " </dev/tty + if [ "${REPLY#[ny]}" != "$REPLY" ]; then + break + fi + done + test "${REPLY#n}" = "$REPLY" || return 1 +} + while read commit; do index=$((index + 1)) if [ $index -le $skip ]; then @@ -72,13 +84,7 @@ while read commit; do for version in $STABLE_BASE_VERSIONS; do queue="$(get_queue $version)" if [ -n "$rest" -o -n "$fixes" ]; then - while true; do - read -p "Do we want this in $version? " </dev/tty - if [ "${REPLY#[ny]}" != "$REPLY" ]; then - break - fi - done - if [ "${REPLY#n}" != "$REPLY" ]; then + if ! read_user_bool "Do we want this in $version?"; then echo "Not adding to $version" continue fi |