git: Allow setup of reference-transaction hook with repo interface
In order to set up the reference-trannsaction hook, one needs to pass in
a gitalypb.Repository
. This is needlessly restrictive: the hook
doesn't use any information which wouldn't be available via the
repository.GitRepo
interface. As a result, callers which do not have
the proto available simply use the helper.ProtoRepoFromRepo()
function
to convert the interface to a proto.
This function is kind of dangerous though if used in different contexts: the resulting proto is lacking project-specific information like the project path and project name. So if one for example has the idea to execute a hook different than the reference-transaction hook with a proto constructed from that function, then we would probably start failing in unintelligible ways later down the road.
Let's fix the interface by instead accepting a repository.GitRepo
as
argument to WithRefTxHook()
, constructing the protobuf right at the
callsite. This ensures we're always passing a consistently-populated
protobuf down to the hook, and thus there is no way that we accidentally
start using info in it which may sometimes be missing.