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.
This commit is contained in:
Mislav Marohnić 2020-02-24 19:36:54 +01:00
parent 53532d6f28
commit c10f2ff945

View file

@ -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