Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

proposal: add command to determine if commit is ancestor of module version #59

Open
myitcv opened this issue Sep 5, 2019 · 0 comments

Comments

@myitcv
Copy link
Collaborator

myitcv commented Sep 5, 2019

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant