python-3.x - 无法在 python (AWS Lambda) 中使用“lambda-git”库使用“diff”命令
问题描述
我在 AWS lambda(python 3.7) 中导入了 git (lambda-git) 库。我能够执行以下所有命令。
git.exec_command("clone", "repo-url", "/tmp/repo")
new_repo_path = '/tmp/repo'
git.exec_command('init', cwd=new_repo_path)
git.exec_command('branch', '-v', cwd=new_repo_path)
git.exec_command('fetch' , cwd=new_repo_path )
git.exec_command('checkout' , 'branch', cwd=new_repo_path )
但是当我尝试使用以下命令时,
git.exec_command('diff','--name-only HEAD HEAD~1', cwd=new_repo_path)
我收到以下错误,
[ERROR] GitExecutionError: command=['git', 'diff', '--name-only HEAD HEAD~1'] returncode=255 stdout="b''" stderr="b'error: invalid option: --name-only HEAD HEAD~1\n'"
但是当我尝试运行与 git cli 相同的命令(如下所示)时,我得到了正确的结果
git diff --name-only HEAD HEAD~1
有什么我想念的吗?有人可以帮我弄这个吗?
解决方案
推荐阅读
- css - CSS继承如何表现?
- c++ - C++ 一个函数上的两个模板关键字
- linux - 无法在远程容器的命名空间内运行隔离进程
- javascript - 如果 $.each() 之前的 json 响应为空,则检查 $.each() 内的 var 内容
- java - 如何避免 selenium 中的 sendKeys 方法清除以前填充的文本?
- android - 手势检测器无法在带有剪辑的custompainter中工作
- prolog - 为什么它给我错误的子集的结果?
- php - 需要来自 URL 的 PHP 文件
- vue.js - 无法从 getter 检索变异数据
- git - 用于 GitHub 项目的 Jenkins 流水线