Fix hook std(err|out) hook handling to be like Ruby
In the Ruby code in GitLab::Git::Hook we return either stderr if there's anything there, or fall back to stdout.
This behavior dates back to gitlab@926a8ab4 ("Handle custom Git hook result in GitLab UI", 2016-07-04). The current Ruby code Gitaly runs was copy/pasted into the tree in 5d0dc144 ("Implement CommitService.FindCommits", 2017-08-14).
When this was ported to Go in f7bb6743 ("operations: Port UserMergeBranch from Ruby to Go", 2020-09-09) this logic error was introduced. Fix it and add tests for this.
Ping: @pks-t, this seems to fix a logic error in your !2540 (merged)
Edited by Ævar Arnfjörð Bjarmason