diff options
author | Sean Whitton <spwhitton@spwhitton.name> | 2019-07-17 08:01:00 +0100 |
---|---|---|
committer | Ian Jackson <ijackson@chiark.greenend.org.uk> | 2019-07-17 14:12:27 +0100 |
commit | dc1baff42723c52e17b5b90fc9b433225798fc61 (patch) | |
tree | acd6141daad272be7d35696df0960c5d46167227 /git-debpush | |
parent | 2ce2ae1def65bb0f9ce5b5ee5ea6734bdc1238a4 (diff) |
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 <spwhitton@spwhitton.name>
Diffstat (limited to 'git-debpush')
-rwxr-xr-x | git-debpush | 38 |
1 files changed, 24 insertions, 14 deletions
diff --git a/git-debpush b/git-debpush index 63057ed..c829579 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 |