Given your stated constraints (specifically, that you have a mapping from tag-name to SHA-1 ID and no other information at all), you cannot get what you want.
The definition of the predicate:
branch name contains commit id
is simply that id is an ancestor1 of the SHA-1 to which name maps. To test this proposition, you must be able to traverse the graph, starting at the node to which name maps and walking back through all paths in the graph until you either run out of nodes, or encounter the given id.
To traverse the graph, though, you must have the graph.
This means there are only two ways to find the answer: have the graph yourself, or get some entity that has the graph to answer the question for you. There is nothing built in to git and git servers to do the latter (though some servers could offer it as an add-on, perhaps).
On the other hand, if you can run git ls-remote
, you can also retrieve the repository, and therefore you can answer the question yourself (at the cost of retrieving the repository, of course).
1For the purpose of this definition, a node is its own ancestor. In this particular degenerate case (where the tag and the tip of the branch match), of course, you can immediately answer the question by looking at the SHA-1 IDs of the branch tips, and these values are available through git ls-remote
.