Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitaly.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPavlo Strokov <pstrokov@gitlab.com>2021-09-22 11:38:20 +0300
committerPavlo Strokov <pstrokov@gitlab.com>2021-09-22 11:38:20 +0300
commita47a975ef7d4ef51e0d68c5662d5cb3bb5b83b76 (patch)
tree25a130f9d43f7f3739dacb2a80f3fe8d3bd8ae53 /internal
parentbdd6fb3bb684094932da2dfd01f9c6bc2b7eb63b (diff)
parent88b946a0de28da1b643c7a90505182858e73facf (diff)
Merge branch 'pks-updateref-print-stderr-when-write-fails' into 'master'
updateref: Fix test flakiness when writing to updater fails See merge request gitlab-org/gitaly!3899
Diffstat (limited to 'internal')
-rw-r--r--internal/git/updateref/updateref.go5
1 files changed, 4 insertions, 1 deletions
diff --git a/internal/git/updateref/updateref.go b/internal/git/updateref/updateref.go
index dde7b5b76..630c3ebb3 100644
--- a/internal/git/updateref/updateref.go
+++ b/internal/git/updateref/updateref.go
@@ -153,7 +153,10 @@ func (u *Updater) Cancel() error {
func (u *Updater) setState(state string) error {
_, err := fmt.Fprintf(u.cmd, "%s\x00", state)
if err != nil {
- return fmt.Errorf("updating state to %q: %w", state, err)
+ // We need to explicitly cancel the command here and wait for it to terminate such
+ // that we can retrieve the command's stderr in a race-free manner.
+ _ = u.Cancel()
+ return fmt.Errorf("updating state to %q: %w, stderr: %q", state, err, u.stderr)
}
// For each state-changing command, git-update-ref(1) will report successful execution via