From: Sean Whitton Date: Wed, 17 Jul 2019 08:31:41 +0000 (+0100) Subject: git-debpush: check that upstream tag is ancestor of $branch X-Git-Tag: archive/debian/9.3~13 X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=commitdiff_plain;h=ae83d742219963877aad83685460f6726d715313;p=dgit.git git-debpush: check that upstream tag is ancestor of $branch Closes: #932096 Signed-off-by: Sean Whitton --- diff --git a/git-debpush b/git-debpush index 80594f5c..39ff4103 100755 --- a/git-debpush +++ b/git-debpush @@ -278,6 +278,14 @@ if ! [ "x$last_debian_tag" = "x" ]; then fi fi +if ! [ "x$upstream_tag" = "x" ] \ + && ! git merge-base --is-ancestor "$upstream_tag" "$branch" \ + && ! [ "$quilt_mode" = "baredebian" ]; then + fail_check \ + "upstream tag $upstream_tag is not an ancestor of $branch; probably a mistake" +fi + + if ! $force && $failed_check; then fail "some checks failed; you can override with --force" fi diff --git a/tests/tests/tagupl b/tests/tests/tagupl index cf750fe6..3b0a7a09 100755 --- a/tests/tests/tagupl +++ b/tests/tests/tagupl @@ -27,7 +27,9 @@ t-tagupl-settings tagname=test-dummy/$v +t-expect-fail "upstream tag $upstreamtag is not an ancestor of refs/heads/master" \ t-tagupl-test --quilt=gbp --upstream=$upstreamtag +t-tagupl-test --quilt=gbp --force --upstream=$upstreamtag t-pushed-good master # todo: test each miss/rejection