Resolve a remote branch's remote

This exposes two different functions to help consumers set the usptream information on a local branch. The scenario here is that I want to set the local branch to track a remote branch. Given a remote branch, I need to know:

1) The remote this branch belongs to
2) Given a remote and a remote tracking branch, what is the corresponding merge branch.

I am suspicious of the code in refspec.c that does this transformation. As it is, the logic here to transform from a destination to source reference closely matches the existing logic to transfrom from a source to destination reference, but maybe this could be improved (

- It requires the consumer to pass in allocated memory
- It does not perform any validation on the strings being transformed. I would expect that they should validate that the source string being transformed matches the src pattern (when transforming from a source to destination reference) or destination patter (when transforming from a destination to source reference).

I am open to other naming suggestions, etc.

Thanks