Git error messages are hidden when getting error on a branch
还没有人认领这个 Issue。
评估
- 难度
- 2/5
- 预计耗时
- 1-3 小时
- 新手友好度
- 55/100
- Issue 类型
- 缺陷
- 描述清晰度
- 描述清楚
- 活跃度
- 停滞
- 技术栈
- git, typescript
- 领域
- cli
调研方向
Start at src/utils/ValidationsHandler.ts around line 174, where the branch commit lookup currently hides Git errors. Reproduce the branch lookup failure with a Docker-mounted repository and verify that the CLI preserves and displays Git's diagnostic output alongside the existing error. Done means users can see the underlying Git failure instead of only the generic message.
由索引模型根据 Issue 内容生成。
描述
We had a problem recently where caprover-cli was showing an error message, but it didn't make any senses:
Cannot find hash of last commit on branch "master".
After a few researches I've found the code that make the error and ran it.
# git rev-parse master
fatal: detected dubious ownership in repository at '<folder>'
To add an exception for this directory, call:
git config --global --add safe.directory <folder>
I've found a similar issue #122 their problem was solved by, not using sudo, but our problem is because we're using docker to run caprover-cli with a volume that is linked to our project folder.
The real issue here is that the code https://github.com/caprover/caprover-cli/blob/c7cdb49850a932c275893ae4289ed16f75c47a1c/src/utils/ValidationsHandler.ts#L174 is obscuring the git error message.
I have a suggestion to display the git error, instead of sending it to /dev/null we could send the error message to a temporary file and print the content when we encounter the error. Being able to have the proper error would have saved us a lot of time.
The program could print something like:
Cannot find hash of last commit on branch "master". Git returned the following errors:
fatal: detected dubious ownership in repository at '<folder>'
To add an exception for this directory, call:
git config --global --add safe.directory <folder>
I would be willing to work on the pull request to add this behaviour.
P.S. for people that have the same problem and are using the caprover/caprover-cli's docker with an upgraded version of git, we added RUN git config --global --add safe.directory <the path of our volume folder> to our Dockerfile to fix the error. We allowed this because we control the docker and it's running locally on our dev's machines, meaning that it's not causing security issues with our workflow.
- 主要语言
- TypeScript
- 星标
- 79
- 派生
- 42
- PR 合并指标
- 30 天内没有已合并 PR
环境准备
- 提供 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 没有贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
caprover/caprover-cli 的其他 Issue
-
难度 3/5 1-2 天 新手友好度 35/100
caprover/caprover-cli#155 ·
-
难度 2/5 1-3 小时 新手友好度 58/100
caprover/caprover-cli#153 ·
-
难度 4/5 3-5 天 新手友好度 35/100
caprover/caprover-cli#148 ·
-
难度 3/5 1-2 天 新手友好度 38/100
caprover/caprover-cli#144 ·
-
难度 4/5 3-5 天 新手友好度 45/100
caprover/caprover-cli#143 · 1 个 reaction ·
查看 caprover/caprover-cli 的全部 Issue
相似的 Issue
-
documentation good first issue roadmap
难度 1/5 1-3 小时 新手友好度 68/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 78/100
resend/react-email#3876 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 82/100
siyuan-note/siyuan#21324 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 74/100
dmno-dev/varlock#1279 · 1 条评论 ·
维护者通常 1 天内回复
-
bug
难度 2/5 1-3 小时 新手友好度 72/100
himynameisdave/bsky-profanity-counter#59 ·
维护者通常 1 天内回复