Skip to content

Include stderr in output of worktree operations

Stan Hu requested to merge sh-include-worktree-stderr into master

If a worktree operation fails (e.g. error: Sparse checkout leaves no entry on working directory), currently no output is stored since the error message is written to stderr. The only way to see the error message is to run strace on the gitaly-ruby instance.

With this change, the stderr output will be included, which will make diagnosing a bug much easier.

Found while trying to see the Git error in !1786 (merged).

Relates to #2395 (closed)

When this error happens, we now see this in the merge request widget:

image

Instead of this:

image

This happens because the presence of the Git error is checked to determine whether an error occurred in the squash operation: https://gitlab.com/gitlab-org/gitlab/blob/8dc70db20529a315778841f3e521880f64a0e1b5/lib/gitlab/gitaly_client/operation_service.rb#L301. Note that noise in stderr won't be sent in a response unless the status of the Git error code is non-zero: https://gitlab.com/gitlab-org/gitaly/blob/e9fc43bd8bca4aa2a45dd3d4ce596a6615049e01/ruby/lib/gitaly_server/operations_service.rb#L309-310.

Edited by GitLab Release Tools Bot

Merge request reports