From 4fcc733b6194bdee895424cab72874e98ea42816 Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Sun, 23 Oct 2016 20:20:24 +0100 Subject: Test suite: import-dsc: New test Signed-off-by: Ian Jackson --- tests/tests/import-dsc | 96 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 96 insertions(+) create mode 100755 tests/tests/import-dsc (limited to 'tests/tests/import-dsc') diff --git a/tests/tests/import-dsc b/tests/tests/import-dsc new file mode 100755 index 0000000..1a9c701 --- /dev/null +++ b/tests/tests/import-dsc @@ -0,0 +1,96 @@ +#!/bin/bash +set -e +. tests/lib + +t-setup-import examplegit + +p=example + +check-import () { + path=$1 + v=$2 + opts=$3 + branch=t.$v + + dsc=${path}/${p}_${v}.dsc + t-dgit $opts import-dsc $dsc $branch + + git checkout $branch + + check-imported $dsc +} + +check-imported () { + local dsc=$1 + ( + rm -rf ../t.unpack + mkdir ../t.unpack + cd ../t.unpack + dpkg-source -x $dsc + ) + + git checkout HEAD~0 + git branch -D u.$v ||: + git checkout -b u.$v $branch + git rm -rf . + git clean -xdf + cp -al ../t.unpack/*/. . + git add -Af . + + git diff --stat --exit-code +} + +cd $p + +check-import ../mirror/pool/main 1.2 + +dgit12=`git rev-parse HEAD` + +dsc2=../mirror/pool/main/${p}_2.0.dsc + +git checkout $branch +t-expect-fail 'is checked out - will not update' \ +t-dgit import-dsc $dsc2 $branch + +git checkout HEAD~0 + +t-expect-fail 'Not fast forward' \ +t-dgit import-dsc $dsc2 $branch + +t-expect-fail 'Not fast forward' \ +t-dgit import-dsc $dsc2 ..$branch + +t-dgit import-dsc $dsc2 +$branch +check-imported $dsc2 + +cd .. +mkdir $p.2 +cd $p.2 + +git init + +check-import ../../../pkg-srcs 1.0-1 + +t-expect-fail "Your git tree does not have that object" \ +check-import ../mirror/pool/main 1.2 + +check-import ../mirror/pool/main 1.2 --force-import-dsc-with-dgit-field + +v=1.0-1.100 +dsc2=../../../pkg-srcs/${p}_${v}.dsc + +t-expect-fail E:'Branch.*already exists' \ +t-dgit import-dsc $dsc2 $branch + +git branch merge-reset +t-dgit import-dsc $dsc2 ..$branch +t-has-ancestor merge-reset $branch + +git push . +merge-reset:$branch + +t-dgit import-dsc $dsc2 +$branch + +mb=$(t-git-merge-base merge-reset $branch) +test "x$mb" = x + +echo ok. -- cgit v1.2.3