chiark / gitweb /
Test suite: Provide t-has-parent
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Sun, 30 Oct 2016 15:03:23 +0000 (15:03 +0000)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Sun, 30 Oct 2016 19:50:48 +0000 (19:50 +0000)
No callers yet.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
tests/lib

index 1d189a9..03bb12d 100644 (file)
--- a/tests/lib
+++ b/tests/lib
@@ -198,6 +198,18 @@ t-has-ancestor () {
        fi
 }
 
+t-has-parent () {
+       # t-has-parent CHILD PARENT
+       local child=$1
+       local parent=$2
+       local parents=$(git show --pretty=format:' %P ' "$child")
+       parent=$(git rev-parse "$parent~0")
+       case "$parents" in
+       *" $parent "*)  ;;
+       *)      fail "child $child lacks parent $parent" ;;
+       esac
+}
+
 t-prep-newpackage () {
        t-select-package $1
        v=$2