Skip to content

Fix getting default branch of remote repo in `FetchInternalRemote`

In order to update contents of a repository on a given node, we use FetchInternalRemote in order to fetch contents of another node which is usually the primary. But as a typical git fetch won't update the repo's HEAD branch, we also have to determine what the remote's repository HEAD is and potentially update our repo's one if it's different. To determine the remote repository's HEAD, we call ref.DefaultBranchName(ctx, req.RemoteRepository). As this function more or less directly maps to git rev-parse --symbolic-full-name which is then executed on the client node, we will fail the request as we're unable to find the remote repo's storage on the local node.

To fix this issue, we need to stop doing the call on the local node but instead call out to the remote Gitaly node's FindDefaultBranchName() RPC. So let's do this instead.

Merge request reports