From fe4db08ba7454c40721c80e05d94f4b8532ce73f Mon Sep 17 00:00:00 2001 From: Sean Whitton Date: Wed, 17 Jul 2019 08:42:43 +0100 Subject: [PATCH] git-debpush: check for pushing the dgit view to the maintainer view Signed-off-by: Sean Whitton --- git-debpush | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/git-debpush b/git-debpush index 969ee619..6c419086 100755 --- a/git-debpush +++ b/git-debpush @@ -201,6 +201,7 @@ trap - EXIT # ---- Gather git history information last_debian_tag=$(find_last_tag "debian/") +last_archive_tag=$(find_last_tag "archive/debian/") # ---- Useful sanity checks @@ -208,15 +209,22 @@ if [ "$target" = "UNRELEASED" ]; then fail_check "UNRELEASED changelog" fi +if ! [ "x$last_debian_tag" = "x" ] && ! [ "x$last_archive_tag" = "x" ]; then + last_debian_tag_c=$(git rev-parse "$last_debian_tag"^{}) + last_archive_tag_c=$(git rev-parse "$last_archive_tag"^{}) + if ! [ "$last_debian_tag_c" = "$last_archive_tag_c" ] \ + && git merge-base --is-ancestor \ + "$last_debian_tag" "$last_archive_tag"; then + fail_check \ +"looks like you might be trying to push the dgit view to the maintainer branch?" + fi +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 if ! $force && $failed_check; then fail "some checks failed; you can override with --force" -- 2.30.2