ref: f76209e01bf9954bd50a84caa02c8883cab1e04a
parent: b993a2d17426409b0af5fa8012ab830c5bf0ccc9
author: Ori Bernstein <ori@eigenstate.org>
date: Mon Sep 6 12:21:37 EDT 2021
git: add test for lca algorithm
--- /dev/null
+++ b/cmd/git/lca.rc
@@ -1,0 +1,41 @@
+#!/bin/rc
+
+. ../util.rc
+
+rm -fr scratch
+mkdir -p scratch
+cd scratch
+
+echo @@ test lca @@
+@{
+ q git/init a
+
+ cd a
+
+ echo 'first' > f
+ q git/add f
+ q git/commit -m base f
+ r=`{git/query HEAD}
+
+ echo 0 > f
+ q git/commit -m a.0 .
+ a=`{git/query HEAD}
+
+ for(i in `{seq 10}){
+ echo $i > f
+ q git/commit -m a.$i .
+ }
+
+ q git/branch -nb $r merge
+ echo x > f
+ q git/commit -m b.0 .
+ b=`{git/query HEAD}
+
+ qq git/merge front
+ q git/commit -m merge .
+ m=`{git/query HEAD}
+
+~ `{git/query $a $m @} $a || die lca a-m
+~ `{git/query $a $b @} $r || die lca a-b
+~ `{git/query $a $r @} $r || die lca a-r
+}
--- a/cmd/git/mkfile
+++ b/cmd/git/mkfile
@@ -4,6 +4,7 @@
add\
basic\
export\
+ lca\
merge
<../../regress