X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;f=tests%2Flib;h=22ae0ff5052a9f349319fc22ffec6ea09b8f1eff;hb=68ace2786dc26749014ea70a6ebb2b896b1f25d1;hp=03c25ce335ac3b96334c48673de29fe558840e82;hpb=26b8f62b600642b1a469a305c3ed8bc0a165a255;p=dgit.git diff --git a/tests/lib b/tests/lib index 03c25ce3..22ae0ff5 100644 --- a/tests/lib +++ b/tests/lib @@ -74,15 +74,22 @@ t-expect-fail () { t-expect-push-fail () { local mpat="$1"; shift + + local triedpush=`git rev-parse HEAD` + t-reporefs pre-push t-expect-fail "$mpat" "$@" t-reporefs post-push diff $tmp/show-refs.{pre,post}-push + t-git-objects-not-present '' $triedpush + eval "$t_expect_push_fail_hook" } t-git-objects-not-present () { + # t-git-objects-not-present GITDIR|'' OBJID [...] + # specifying '' means the repo for package $p local gitdir="${1-$tmp/git/$p.git}" local obj if ! [ -e "$gitdir" ]; then return; fi @@ -295,6 +302,16 @@ t-clean-on-branch () { t-output "## $1" git status -b --porcelain } +t-git-get-ref-exact () { + local ref=$1 + # does not dereference, unlike t-git-get-ref + case "$ref" in + refs/*) ;; + *) fail "t-git-get-ref-exact bad $ref" ;; + esac + git for-each-ref --format='%(objectname)' "[r]efs/${ref#refs/}" +} + t-git-get-ref () { local ref=$1 case "$ref" in @@ -416,6 +433,15 @@ t-tstunt-parsechangelog () { t-tstunt dpkg-parsechangelog Dpkg/Changelog/Parse.pm } +t-prep-mergechangelogs () { + local b=merge.dpkg-mergechangelogs + git config $b.name 'debian/changelog merge driver' + git config $b.driver 'dpkg-mergechangelogs -m %O %A %B %A' + mkdir -p .git/info + echo >>.git/info/attributes \ + 'debian/changelog merge=dpkg-mergechangelogs' +} + t-ref-dsc-dgit () { local dsc=${p}_${v}.dsc local val=`t-822-field $tmp/incoming/$dsc Dgit` @@ -449,12 +475,16 @@ t-drs () { t-git-config dgit-distro.test-dummy.git-url "ext::$troot/drs-git-ext %S " t-git-config dgit-distro.test-dummy.git-check true t-git-config dgit-distro.test-dummy.git-create true - cp $root/tests/gnupg/{dd.gpg,dm.gpg,dm.txt} $tmp/. - cp $root/tests/suites $tmp/. + cp $troot/gnupg/{dd.gpg,dm.gpg,dm.txt} $tmp/. + cp $troot/suites $tmp/. drs_dispatch=$tmp/distro=test-dummy mkdir $drs_dispatch - ln -sf $root $drs_dispatch/dgit-live + + if [ "x$DGIT_TEST_INTREE" != x ]; then + ln -sf "$DGIT_TEST_INTREE" $drs_dispatch/dgit-live + fi + ln -sf $tmp/git $drs_dispatch/repos ln -sf $tmp/suites $tmp/dm.txt $drs_dispatch/ mkdir -p $drs_dispatch/keyrings