ref: e87ff91fdaa4b98530a7048ae460912647d95bd8
dir: /cmd/git/lca.rc/
#!/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 }