Skip to content

fix(git): preserve env-backed simple-git behavior (re-submit of #323)#330

Merged
MocA-Love merged 3 commits intomainfrom
fix/simple-git-pager-env-v2
Apr 18, 2026
Merged

fix(git): preserve env-backed simple-git behavior (re-submit of #323)#330
MocA-Love merged 3 commits intomainfrom
fix/simple-git-pager-env-v2

Conversation

@MocA-Love
Copy link
Copy Markdown
Owner

#323 を revert (#329) したため、同内容の PR を再作成したもの。レビューのやり直しを前提としており、問題なければ改めてマージする想定。

内容

シェル環境に `PAGER=less` など simple-git 3.36+ の block-unsafe-operations プラグインが弾く env が設定されていると、以下のエラーで desktop アプリ内の worktree / workspace 操作が失敗する:

```
Use of "PAGER" is not permitted without enabling allowUnsafePager
```

採用アプローチ

env を strip するのではなく、env に存在する unsafe キーに対応する `allowUnsafe` フラグだけを simple-git に渡す* 方式。

  • `packages/shared/src/simple-git-unsafe.ts` に `buildSimpleGitUnsafeOptions(env)` helper を追加
  • `apps/desktop` と `packages/host-service` 両方の simple-git 呼び出しを helper 経由に統一
  • `GIT_SSH_COMMAND` 等のカスタム SSH 設定は env として保持されるため、SSH 経由 fetch/ls-remote が壊れない

差分

#323 と同じ 2 コミット (b8d0c97 + ab78b34) を cherry-pick:

  • `fix(desktop): simple-git 3.36+ の PAGER env ブロックを回避`
  • `fix(git): preserve env-backed simple-git behavior` (Codex レビュー P1 指摘 `GIT_SSH*` 保持対応)

ユーザーのシェル環境に PAGER や EDITOR 等が設定されていると、
simple-git 3.36+ の block-unsafe-operations プラグインが
`Use of "PAGER" is not permitted without enabling allowUnsafePager`
を投げて、ワークスペースの削除・worktree 操作等がすべて失敗する。

upstream v1.5.5 の同梱 simple-git が 3.36.0 に上がった結果、
`PAGER=less` をログインシェルで設定しているユーザーで発生していた。

simple-git が弾く env キー (PAGER/EDITOR/GIT_* 系) は
このアプリの git 操作では不要なので、env に詰める前に除外する。
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 18, 2026

Warning

Rate limit exceeded

@MocA-Love has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 19 minutes and 8 seconds before requesting another review.

Your organization is not enrolled in usage-based pricing. Contact your admin to enable usage-based pricing to continue reviews beyond the rate limit, or try again in 19 minutes and 8 seconds.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: ed8e8127-a536-472c-8dff-acbfe1aeca4f

📥 Commits

Reviewing files that changed from the base of the PR and between 3257efc and 01dc63b.

📒 Files selected for processing (9)
  • apps/desktop/src/lib/trpc/routers/projects/projects.ts
  • apps/desktop/src/lib/trpc/routers/workspaces/utils/git-client.ts
  • packages/host-service/src/runtime/git/git.ts
  • packages/host-service/src/runtime/git/simple-git.ts
  • packages/host-service/src/trpc/router/project/project.ts
  • packages/host-service/src/trpc/router/workspace-creation/workspace-creation.ts
  • packages/host-service/src/trpc/router/workspace/workspace.ts
  • packages/shared/package.json
  • packages/shared/src/simple-git-unsafe.ts
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/simple-git-pager-env-v2

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@MocA-Love MocA-Love merged commit 924f99b into main Apr 18, 2026
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant