I am trying to write a check to make sure that a submodule actually points to a commit that is in the direct history of the master branch in that submodule (not a branch that is pending for merge on the master branch).
I tried parsing the git log output using:
git log --format=format:%H --first-parent master | grep COMMITID
but I feel like git offers a better solution that this one, something that would rely on a more standard feature from git (not pipe'ing to grep).
For example, the super project includes the following submodule:
A---B---C topic
/
D---E---F---G master
If the superproject points directly to topic, then an error would be reported because next time the super project updates the submodule to master, the topic would be lost.
On the contrary:
A---B---C topic
/ \
D---E---F---G---H master
If super project points to master it would not report an error.
Nice to have would be to be able to check that topic is actually merged but this is currently optional because I am not even sure that I would have the commit id of topic before merge available when running the script.