#!/bin/sh

set -e

. ./helpers.sh

# Without UPSTREAM_GIT and without --ask-upstream-git, the debian/watch
# operation guesses https://github.com/openstack/<source>: when that
# repository cannot be verified to exist, the operation must be skipped
# with a warning, and the other operations must still run.

set_stub_rmadison "" 0
make_fixture "1.0.0-1" unstable "nosuchpackage-pkgos-modernize-test" ""

run_modernize
assert_eq "exit code" "${MODERNIZE_RC}" "0"
assert_eq "watch not created" "$(test -f debian/watch && echo yes || echo no)" "no"
assert_contains "warning printed" "${OUT}" "skipping the debian/watch update"
assert_contains "hint printed" "${OUT}" "define UPSTREAM_GIT in debian/rules"
assert_not_contains "no watch commit" "$(git log --format=%s)" "Update debian/watch"
assert_contains "other ops ran" "$(cat debian/control)" "debhelper-compat (= 13)"

exit 0
