summaryrefslogtreecommitdiff
path: root/tests/lib
diff options
context:
space:
mode:
authorIan Jackson <ijackson@chiark.greenend.org.uk>2016-08-30 01:37:06 +0100
committerIan Jackson <ijackson@chiark.greenend.org.uk>2016-09-06 13:20:35 +0100
commitfbc24ade1654c35ac59f8c6f4ebaaba0e65930ee (patch)
treebd51e2022e47dd51a5a426b6ded0090b10481366 /tests/lib
parent0c398a9586ef4807c3e6f2eec87173b2e081369a (diff)
Test suite: Provide t-sametree-parent
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
Diffstat (limited to 'tests/lib')
-rw-r--r--tests/lib22
1 files changed, 22 insertions, 0 deletions
diff --git a/tests/lib b/tests/lib
index 9b8894e..36237a7 100644
--- a/tests/lib
+++ b/tests/lib
@@ -508,6 +508,28 @@ t-v-tag () {
echo refs/tags/$tagpfx/${v//\~/_}
}
+t-format-ref () {
+ git log -n1 --pretty=format:"$1" "$2"
+}
+
+t-sametree-parent () {
+ local ref=$1
+ local parent
+ local ctree=$(t-format-ref '%T' "$ref")
+ while :; do
+ local psame=''
+ for parent in $(t-format-ref '%P' "$ref"); do
+ local ptree=$(t-format-ref '%T' "$parent")
+ if [ "x$ptree" = "x$ctree" ]; then
+ psame+=" $parent"
+ fi
+ done
+ case "$psame" in ""|" * *") break ;; esac
+ ref="${psame# }"
+ done
+ echo "$ref"
+}
+
t-check-pushed-master () {
local master=`t-git-get-ref refs/heads/master`
if [ x$master = x$t_ref_val ]; then return; fi