强制执行 Git:无效选项:-r

Perforce to Git: Invalid option: -r

我正在尝试将一个项目从 Perforce 迁移到 Git。我使用 git-p4 作为我的主要工具来为我完成繁重的工作,默认情况下它在 Windows 上带有 Git:

C:\Program Files\Git\mingw64\libexec\git-core\git-p4.

Migrating Perforce to Git in Windows 之后,我已经到了执行克隆命令的步骤:git p4 clone <PerforceRepo>(其中 p4 是文件 git-p4.py 的别名)

我不断收到错误消息:

Invalid option: -r.

C:\P4-To-Git>git p4 clone //depot/C:\build\mainline@all .
Importing from //depot/C:/build/mainline@all into .
Reinitialized existing Git repository in C:/P4-To-Git/.git/
Perforce client error:
        p4 -h for usage.
        Invalid option: -r.
Traceback (most recent call last):
  File "C:\Program Files\Git\mingw64\libexec\git-core\git-p4", line 3840, in <module>
    main()
  File "C:\Program Files\Git\mingw64\libexec\git-core\git-p4", line 3834, in main
    if not cmd.run(args):
  File "C:\Program Files\Git\mingw64\libexec\git-core\git-p4", line 3706, in run
    if not P4Sync.run(self, depotPaths):
  File "C:\Program Files\Git\mingw64\libexec\git-core\git-p4", line 3546, in run
    changes = p4ChangesForPaths(self.depotPaths, self.changeRange, self.changes_block_size)
  File "C:\Program Files\Git\mingw64\libexec\git-core\git-p4", line 852, in p4ChangesForPaths
    changeEnd = p4_last_change()
  File "C:\Program Files\Git\mingw64\libexec\git-core\git-p4", line 317, in p4_last_change
    return int(results[0]['change'])
KeyError: 'change'

我查看了 p4-git python 文件,没有地方使用了 -r。有帮助吗?

尝试将 git-p4.retries 设置为 0?

if retries > 0:
    # Provide a way to not pass this option by setting git-p4.retries to 0
    real_cmd += ["-r", str(retries)]

或者升级您的 p4 可执行文件,使其支持 -r 全局标志 -- 此选项已添加到 2012.2 版本中:

Minor new functionality in 2012.2

    #384638 *** ** *
        The net.maxwait configurable can be used to specify a hard limit
        (in seconds) on the maximum time that a connection will wait for
        any single network send or receive to complete. The 'p4 sync'
        command now supports a '-r' global flag to specify that the sync
        command should be retried if a network error occurs.