CreateRepositoryFromURL RPC returns wrong error code when repository does not exist

Summary

Geo works with the following logic:

  • If a repository is not present on a Geo secondary site
    • Do the initial bootstrap using git clone using a JWT header for authentication
  • If a repository is present on a Geo secondary site
    • Run git fetch using a JWT header for authentication

But the CreateRepositoryFromURL RPC returns the wrong error, Gitlab::Git::CommandError with message 13:creating repository: cloning repository: exit status 128., when the repository does not exist on the Geo primary site. This breaks the Geo no repo on the primary special case causing some issues like gitlab#462735 (closed). We need it to behave like the FetchRemote RPC which returns Gitlab::Git::Repository::NoRepository with message 5:repository not found..

Steps to reproduce

  1. On a Geo secondary site, run the following on a Rails console session:
p = Project.last
r = p.repository; r.remove; r.expire_exists_cache
s = Geo::FrameworkRepositorySyncService.new(p.replicator)

begin s.send(:clone_geo_mirror); rescue StandardError => e; puts e.code, e.class, e.message; end
=> internal
=> Gitlab::Git::CommandError
=> 13:creating repository: cloning repository: exit status 128.

begin s.send(:fetch_geo_mirror); rescue StandardError => e; puts e.code, e.class, e.message; end
=> not_found
=> Gitlab::Git::Repository::NoRepository
=> 5:repository not found.
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information