threads / patch / 50174

patchgit-p4: fix problem when p4 login is not necessary

Subject: [PATCH] git-p4: fix problem when p4 login is not necessary

## tl;dr

3 messages between Jan 7, 2019 and Jan 7, 2019. Diffs are folded; open one to read it.

replies: 2people: 3as markdown or json

Peter Osterlund· Jan 7, 2019, 20:51 UTC · lore

In a perforce setup where login is not required, communication fails because p4_check_access does not understand the response from the p4 client. Fixed by detecting and ignoring the "info" response.

Signed-off-by: Peter Osterlund <peterosterlund2@gmail.com>
---
  git-p4.py | 2 ++
  1 file changed, 2 insertions(+)
Show changes to git-p4.py +2 −0
diff --git a/git-p4.py b/git-p4.py
index 1998c3e141..3e12774f96 100755
--- a/git-p4.py
+++ b/git-p4.py
@@ -332,6 +332,8 @@ def p4_check_access(min_expiration=1):
              die_bad_access("p4 error: {0}".format(data))
          else:
              die_bad_access("unknown error")
+    elif code == "info":
+        return
      else:
          die_bad_access("unknown error code {0}".format(code))
-- 
Peter Osterlund - peterosterlund2@gmail.com
http://hem.bredband.net/petero2b
Luke Diamand· Jan 7, 2019, 22:05 UTC · re: Peter Osterlund · lore

Re: [PATCH] git-p4: fix problem when p4 login is not necessary

On Mon, 7 Jan 2019 at 20:51, Peter Osterlund <peterosterlund2@gmail.com> wrote:
>
> In a perforce setup where login is not required, communication fails
> because p4_check_access does not understand the response from the p4
> client. Fixed by detecting and ignoring the "info" response.

This is caused by my earlier change in this area. I think this fix looks good, thanks. Ack.

Show 23 quoted lines
>
> Signed-off-by: Peter Osterlund <peterosterlund2@gmail.com>
> ---
>   git-p4.py | 2 ++
>   1 file changed, 2 insertions(+)
>
> diff --git a/git-p4.py b/git-p4.py
> index 1998c3e141..3e12774f96 100755
> --- a/git-p4.py
> +++ b/git-p4.py
> @@ -332,6 +332,8 @@ def p4_check_access(min_expiration=1):
>               die_bad_access("p4 error: {0}".format(data))
>           else:
>               die_bad_access("unknown error")
> +    elif code == "info":
> +        return
>       else:
>           die_bad_access("unknown error code {0}".format(code))
>
>
> --
> Peter Osterlund - peterosterlund2@gmail.com
> http://hem.bredband.net/petero2b
Junio C Hamano· Jan 7, 2019, 22:24 UTC · re: Luke Diamand · lore

Re: [PATCH] git-p4: fix problem when p4 login is not necessary

Luke Diamand <luke@diamand.org> writes:
Show 33 quoted lines
> On Mon, 7 Jan 2019 at 20:51, Peter Osterlund <peterosterlund2@gmail.com> wrote:
>>
>> In a perforce setup where login is not required, communication fails
>> because p4_check_access does not understand the response from the p4
>> client. Fixed by detecting and ignoring the "info" response.
>
> This is caused by my earlier change in this area. I think this fix
> looks good, thanks.
> Ack.
>
>>
>> Signed-off-by: Peter Osterlund <peterosterlund2@gmail.com>
>> ---
>>   git-p4.py | 2 ++
>>   1 file changed, 2 insertions(+)
>>
>> diff --git a/git-p4.py b/git-p4.py
>> index 1998c3e141..3e12774f96 100755
>> --- a/git-p4.py
>> +++ b/git-p4.py
>> @@ -332,6 +332,8 @@ def p4_check_access(min_expiration=1):
>>               die_bad_access("p4 error: {0}".format(data))
>>           else:
>>               die_bad_access("unknown error")
>> +    elif code == "info":
>> +        return
>>       else:
>>           die_bad_access("unknown error code {0}".format(code))
>>
>>
>> --
>> Peter Osterlund - peterosterlund2@gmail.com
>> http://hem.bredband.net/petero2b

The patch was whitespace damaged, but for a two-liner like this, I can type it myself instead, so no need to resend.

Thanks, both.

← back to recent threads