localrepo: Update `ReadTree()` submodule error handling
The ReadTree()
function takes a treeish and path to form a
path-scoped revision used read tree entries from. When the provided path
refers to a Git submodule, the revision is resolved to the commit ID of
the submodule. The next operation in ReadTree()
uses the resolved
revision to retrieve its object info to ensure it is a tree. Since the
submodule commit ID is from a different repository, the object is unable
to be found and results in an error. If a provided path goes inside a
submodule, the revision is immediately unable to be resolved and a
different error is returned.
In the GetTreeEntries
RPC, an error resulting from trying to read a
submodule path causes uses the internal error code. Since reading tree
entries of a submodule is not supported, any path referencing a
submodule should return the same error as other invalid paths.
Update ReadTree()
to return a git.ReferenceNotFound
error when the
provided path references as Git submodule. Also update the
TestGetTreeEntries
for a submodule path to demonstrate the change.
Related: #6203 (closed)