chiark / gitweb /
Avoid use of "my $_", which is not portable
[dgit.git] / tests / lib
index 5b93d98dc86b074d71080106cf9ca35a8ec43e9c..22ae0ff5052a9f349319fc22ffec6ea09b8f1eff 100644 (file)
--- a/tests/lib
+++ b/tests/lib
@@ -302,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
@@ -423,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`
@@ -456,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