From dc1baff42723c52e17b5b90fc9b433225798fc61 Mon Sep 17 00:00:00 2001 From: Sean Whitton Date: Wed, 17 Jul 2019 08:01:00 +0100 Subject: [PATCH] git-debpush: introduce and call fail_check Without this, passing --force to override an earlier sanity check might cause the user to miss the output of a later sanity check, which would never get run. We don't want to have multiple forcing options to override different sanity checks, as that is too much complexity for a script like this. So always run all checks, and error out afterwards if at least one of them failed. Signed-off-by: Sean Whitton --- git-debpush | 38 ++++++++++++++++++++++++-------------- 1 file changed, 24 insertions(+), 14 deletions(-) diff --git a/git-debpush b/git-debpush index 63057ed2..c8295798 100755 --- a/git-debpush +++ b/git-debpush @@ -63,6 +63,16 @@ get_file_from_ref () { fi } +failed_check=false +fail_check () { + if $force; then + echo >&2 "$us: warning: $*" + else + echo >&2 "$us: $*" + failed_check=true + fi +} + # ---- Parse command line getopt=$(getopt -s bash -o 'nfu:' \ @@ -177,22 +187,22 @@ trap - EXIT # ---- Useful sanity checks -if ! $force; then - - if [ "$target" = "UNRELEASED" ]; then - fail "UNRELEASED changelog" - fi +if [ "$target" = "UNRELEASED" ]; then + fail_check "UNRELEASED changelog" +fi - # TODO additional checks we might do: - # - # - are we uploading to a different suite from the last tag - # (e.g. unstable after experimental)? user should pass option to - # confirm - # - # - walking backwards from $branch, if there is an archive/ strictly - # before we reach most recent debian/ tag, error, this might be a - # push of the dgit view to the maintainer branch +# TODO additional checks we might do: +# +# - are we uploading to a different suite from the last tag +# (e.g. unstable after experimental)? user should pass option to +# confirm +# +# - walking backwards from $branch, if there is an archive/ strictly +# before we reach most recent debian/ tag, error, this might be a +# push of the dgit view to the maintainer branch +if ! $force && $failed_check; then + fail "some checks failed; you can override with --force" fi # ---- Create the git tag -- 2.30.2