{"thread":{"id":"44789","subject":"[PATCH v2] git-p4: do not pass '-r 0' to p4 commands","startedAt":"2016-12-29T10:23:51Z","lastAt":"2017-01-04T09:17:27Z","messageCount":3,"participants":["Igor Kushnir","Ori Rawlings","Luke Diamand"],"isPatch":true,"patchVersion":2,"patchTotal":null},"messages":[{"id":"308489","messageId":"20161229102223.6028-1-igorkuo@gmail.com","threadId":"44789","inReplyTo":null,"subject":"[PATCH v2] git-p4: do not pass '-r 0' to p4 commands","fromName":"Igor Kushnir","fromEmail":"igorkuo@gmail.com","sentAt":"2016-12-29T10:22:23Z","receivedAt":"2016-12-29T10:23:51Z","isPatch":true,"sender":{"key":"igorkuo@gmail.com","avatar":null},"body":"git-p4 crashes when used with a very old p4 client version\nthat does not support the '-r <number>' option in its commands.\n\nAllow making git-p4 work with old p4 clients by setting git-p4.retries to 0.\n\nAlternatively git-p4.retries could be made opt-in.\nBut since only very old, barely maintained p4 versions don't support\nthe '-r' option, the setting-retries-to-0 workaround would do.\n\nThe \"-r retries\" option is present in Perforce 2012.2 Command Reference,\nbut absent from Perforce 2012.1 Command Reference.\n\nSigned-off-by: Igor Kushnir <igorkuo@gmail.com>\n---\n Documentation/git-p4.txt | 2 ++\n git-p4.py                | 4 +++-\n 2 files changed, 5 insertions(+), 1 deletion(-)\n\ndiff --git a/Documentation/git-p4.txt b/Documentation/git-p4.txt\nindex bae862ddc..7436c64a9 100644\n--- a/Documentation/git-p4.txt\n+++ b/Documentation/git-p4.txt\n@@ -479,6 +479,8 @@ git-p4.client::\n git-p4.retries::\n \tSpecifies the number of times to retry a p4 command (notably,\n \t'p4 sync') if the network times out. The default value is 3.\n+\tSet the value to 0 to disable retries or if your p4 version\n+\tdoes not support retries (pre 2012.2).\n \n Clone and sync variables\n ~~~~~~~~~~~~~~~~~~~~~~~~\ndiff --git a/git-p4.py b/git-p4.py\nindex 22e3f57e7..7bda915bd 100755\n--- a/git-p4.py\n+++ b/git-p4.py\n@@ -83,7 +83,9 @@ def p4_build_cmd(cmd):\n     if retries is None:\n         # Perform 3 retries by default\n         retries = 3\n-    real_cmd += [\"-r\", str(retries)]\n+    if retries > 0:\n+        # Provide a way to not pass this option by setting git-p4.retries to 0\n+        real_cmd += [\"-r\", str(retries)]\n \n     if isinstance(cmd,basestring):\n         real_cmd = ' '.join(real_cmd) + ' ' + cmd\n-- \n2.11.0\n\n"},{"id":"308743","messageId":"CAPv0x+PoQ+3ERAc_0gviYP5j1-Zg=X+B1OSC6vDKatqUhFtAag@mail.gmail.com","threadId":"44789","inReplyTo":"20161229102223.6028-1-igorkuo@gmail.com","subject":"Re: [PATCH v2] git-p4: do not pass '-r 0' to p4 commands","fromName":"Ori Rawlings","fromEmail":"orirawlings@gmail.com","sentAt":"2017-01-03T20:02:58Z","receivedAt":"2017-01-03T20:03:49Z","isPatch":true,"sender":{"key":"orirawlings@gmail.com","avatar":"https://gravatar.com/avatar/e0b03bf25fd033ff21a27f7c801240da759f001b28acfa3087f60532bd4c9fa6?d=mp&s=160"},"body":"Looks good to me.\n\n\nOri Rawlings\n"},{"id":"308767","messageId":"CAE5ih7_D4F=vic+Dud-QwTushVmW200W8C+T6H+igH+WoSz6rA@mail.gmail.com","threadId":"44789","inReplyTo":"CAPv0x+PoQ+3ERAc_0gviYP5j1-Zg=X+B1OSC6vDKatqUhFtAag@mail.gmail.com","subject":"Re: [PATCH v2] git-p4: do not pass '-r 0' to p4 commands","fromName":"Luke Diamand","fromEmail":"luke@diamand.org","sentAt":"2017-01-04T09:09:30Z","receivedAt":"2017-01-04T09:17:27Z","isPatch":true,"sender":{"key":"luke@diamand.org","avatar":"https://avatars.githubusercontent.com/u/5330967?v=4"},"body":"On 3 January 2017 at 20:02, Ori Rawlings <orirawlings@gmail.com> wrote:\n> Looks good to me.\n\nAnd me.\n\n\n\n>\n>\n> Ori Rawlings\n"}]}