Repository#log_by_shell fails if there are warnings in output
This is related to https://gitlab.com/gitlab-org/gitlab-ce/issues/49963. A user gets a 503 viewing a commit page.
In https://gitlab.com/gitlab-org/gitaly/blob/a87197e6cddaf5a3589626153963ea4be74443f0/ruby/lib/gitlab/git/repository.rb#L667-668, we run git log --format=%H --skip=0 <commit SHA>
, but it's possible to get warnings as the following:
$ git log --format=%H --skip=0 5c33d72799ce420c6620df2582b21df8309e7147
warning: refname '5c33d72799ce420c6620df2582b21df8309e7147' is ambiguous.
Git normally never creates a ref that ends with 40 hex characters
because it will be ignored when you just specify 40-hex. These refs
may be created by mistake. For example,
git checkout -b $br $(git rev-parse ...)
where "$br" is somehow empty and a 40-hex ref is created. Please
examine these refs and maybe delete them. Turn this message off by
running "git config advice.objectNameWarning false"
5c33d72799ce420c6620df2582b21df8309e7147
e0579c3ad2b4e3ccf3cf2b20d298e5b7116a7711
We could filter these lines with a regexp, but a better solution would be to only use the stdout output and log the stderr output as a warning.