I'm not entirely sure this belongs in gohack, but given the -vcs flag gohack makes answering it possible. So raising here for discussion at least.
I'm trying to answer the following question:
Given commit $commit, are we currently using a version of module $m that that has $commit as an ancestor?
The answer is in effect given by this sequence of commands:
GOHACK=$(mktemp -d) gohack get -vcs golang.org/x/tools
pushd $(go list -m -f {{.Replace.Dir}} golang.org/x/tools)
answer=$(git merge-base --is-ancestor $commit HEAD && echo "yes" || echo "no")
popd
gohack undo golang.org/x/tools
Does it make sense to provide a gohack command that answers this question?
cc @rogpeppe @mvdan