{"thread":{"id":"51399","subject":"git p4 sync: \"str expected, not %s\"","startedAt":"2019-06-28T09:57:47Z","lastAt":"2019-07-17T10:59:50Z","messageCount":3,"participants":["Massimo B."],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"378252","messageId":"34d6121da46f35e4b81d38169b1b86ca123cef37.camel@gmx.net","threadId":"51399","inReplyTo":null,"subject":"git p4 sync: \"str expected, not %s\"","fromName":"Massimo B.","fromEmail":"massimo.b@gmx.net","sentAt":"2019-06-28T09:57:41Z","receivedAt":"2019-06-28T09:57:47Z","isPatch":false,"sender":{"key":"massimo.b@gmx.net","avatar":null},"body":"Hello everybody,\n\nsince last updates, git p4 does not work anymore:\n\n# git p4 sync --verbose\nReading pipe: ['git', '--git-dir', '/mnt/data/userspace/project-pb/MM6.test/.git', 'rev-parse', '--git-dir']\nReading pipe: git rev-parse --git-dir\nReading pipe: git rev-parse --show-cdup\nReading pipe: ['git', '--git-dir', b'.', 'rev-parse', '--git-dir']\nTraceback (most recent call last):\n  File \"/usr/libexec/git-core/git-p4\", line 4163, in <module>\n    main()\n  File \"/usr/libexec/git-core/git-p4\", line 4155, in main\n    os.environ[\"GIT_DIR\"] = cmd.gitdir\n  File \"/usr/lib64/python3.6/os.py\", line 674, in __setitem__\n    value = self.encodevalue(value)\n  File \"/usr/lib64/python3.6/os.py\", line 744, in encode\n    raise TypeError(\"str expected, not %s\" % type(value).__name__)\nTypeError: str expected, not bytes\n\ngit version 2.22.0\nGentoo Linux\nGlobal Python is 3.6.\n\nLast working version I found: 2.20.1\n\nBest regards,\nMassimo\n\n"},{"id":"378880","messageId":"edb1cc8f69e59015033604530513ff58f0bf8256.camel@gmx.net","threadId":"51399","inReplyTo":"17077551562900174@sas1-9134aa144859.qloud-c.yandex.net","subject":"Re: git p4 sync: \"str expected, not %s\"","fromName":"Massimo B.","fromEmail":"massimo.b@gmx.net","sentAt":"2019-07-12T10:01:26Z","receivedAt":"2019-07-12T10:01:34Z","isPatch":false,"sender":{"key":"massimo.b@gmx.net","avatar":null},"body":"On Thu, 2019-07-11 at 22:56 -0400, Andrey wrote:\n\n> Strangely, I don't see any changes that could have broken it between 2.20.1\n> and 2.22.0.\n\n> Are you sure your git repository is not \"bare\", i.e. there's .git\n> subdirectory?\n> Looks like, it doesn't think that \"MM6.test/.git\" is a valid git repository\n> while it would normally be.\n\nI forgot to say, yes it is a bare repo, was created like this:\n# git p4 clone --bare //MM6.test@all --verbose\n\n> Anyway, could you, please, try the patch below to see if it helps?\n\nI did, but this fails now like this:\n\nfatal: cannot locate git repository at b'.'\n\nBest regards,\nMassimo\n\n"},{"id":"379005","messageId":"61d7947142367c3abf6d6f0af60181a0677ce954.camel@gmx.net","threadId":"51399","inReplyTo":"23610851562985541@iva7-634c9cb1f49d.qloud-c.yandex.net","subject":"Re: git p4 sync: \"str expected, not %s\"","fromName":"Massimo B.","fromEmail":"massimo.b@gmx.net","sentAt":"2019-07-17T10:54:46Z","receivedAt":"2019-07-17T10:59:50Z","isPatch":false,"sender":{"key":"massimo.b@gmx.net","avatar":null},"body":"Still failing:\n\nOn Fri, 2019-07-12 at 22:39 -0400, Andrey wrote:\n\n> Could you, please, try the patch below?\n>\n> diff --git a/git-p4.py b/git-p4.py\n> index 5b79920f46..f5be048348 100755\n> --- a/git-p4.py\n> +++ b/git-p4.py\n> @@ -4137,13 +4137,13 @@ def main():\n>      if cmd.needsGit:\n>          if cmd.gitdir == None:\n>              cmd.gitdir = os.path.abspath(\".git\")\n>              if not isValidGitDir(cmd.gitdir):\n>                  # \"rev-parse --git-dir\" without arguments will try $PWD/.git\n> -                cmd.gitdir = read_pipe(\"git rev-parse --git-dir\").strip()\n> +                cmd.gitdir = read_pipe(\"git rev-parse --git-\n> dir\").strip().decode()\n>                  if os.path.exists(cmd.gitdir):\n> -                    cdup = read_pipe(\"git rev-parse --show-cdup\").strip()\n> +                    cdup = read_pipe(\"git rev-parse --show-\n> cdup\").strip().decode()\n>                      if len(cdup) > 0:\n>                          chdir(cdup);\n>\n>          if not isValidGitDir(cmd.gitdir):\n>              if isValidGitDir(cmd.gitdir + \"/.git\"):\n\n# git p4 sync\nTraceback (most recent call last):\n  File \"/usr/libexec/git-core/git-p4\", line 4163, in <module>\n    main()\n  File \"/usr/libexec/git-core/git-p4\", line 4157, in main\n    if not cmd.run(args):\n  File \"/usr/libexec/git-core/git-p4\", line 3569, in run\n    branches = p4BranchesInGit(self.importIntoRemotes)\n  File \"/usr/libexec/git-core/git-p4\", line 844, in p4BranchesInGit\n    if not line.startswith('p4/'):\nTypeError: startswith first arg must be bytes or a tuple of bytes, not str\n\n\n> Or, even this one:\n>\n> diff --git a/git-p4.py b/git-p4.py\n> index 5b79920f46..2bf6720911 100755\n> --- a/git-p4.py\n> +++ b/git-p4.py\n> @@ -196,6 +196,10 @@ def read_pipe_full(c):\n>      expand = isinstance(c,basestring)\n>      p = subprocess.Popen(c, stdout=subprocess.PIPE, stderr=subprocess.PIPE,\n> shell=expand)\n>      (out, err) = p.communicate()\n> +    if out is not None:\n> +        out = out.decode()\n> +    if err is not None:\n> +        err = err.decode()\n>      return (p.returncode, out, err)\n>\n>  def read_pipe(c, ignore_error=False):\n\n# git p4 sync\nTraceback (most recent call last):\n  File \"/usr/libexec/git-core/git-p4\", line 4167, in <module>\n    main()\n  File \"/usr/libexec/git-core/git-p4\", line 4146, in main\n    cmd.gitdir = read_pipe(\"git rev-parse --git-dir\").strip().decode()\nAttributeError: 'str' object has no attribute 'decode'\n\nBest regards,\nMassimo\n\n"}]}