From c10f2ff9455abbf1de74511b83bf274ab4ce7601 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mislav=20Marohni=C4=87?= Date: Mon, 24 Feb 2020 19:36:54 +0100 Subject: [PATCH] Communicate to the user that we're waiting before retrying `git push` When the user has just created a fork, it might not yet be ready for writing. This ensures that the wait period between retries is communicated to the user on stderr. --- command/pr_create.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/command/pr_create.go b/command/pr_create.go index 64f43c895..c40f5d8c9 100644 --- a/command/pr_create.go +++ b/command/pr_create.go @@ -99,7 +99,9 @@ func prCreate(cmd *cobra.Command, _ []string) error { if didForkRepo && pushTries < maxPushTries { pushTries++ // first wait 2 seconds after forking, then 4s, then 6s - time.Sleep(time.Duration(2*pushTries) * time.Second) + waitSeconds := 2 * pushTries + fmt.Fprintf(cmd.ErrOrStderr(), "waiting %s before retrying...\n", utils.Pluralize(waitSeconds, "second")) + time.Sleep(time.Duration(waitSeconds) * time.Second) continue } return err