Skip to content

fix: set GIT_TERMINAL_PROMPT=0 so invalid git deps fail fast#5988

Merged
baszalmstra merged 1 commit intoprefix-dev:mainfrom
baszalmstra:claude/fix-issue-5503-l1L1G
May 4, 2026
Merged

fix: set GIT_TERMINAL_PROMPT=0 so invalid git deps fail fast#5988
baszalmstra merged 1 commit intoprefix-dev:mainfrom
baszalmstra:claude/fix-issue-5503-l1L1G

Conversation

@baszalmstra
Copy link
Copy Markdown
Contributor

@baszalmstra baszalmstra commented May 1, 2026

Description

When a host- or source-dependency points at a non-existent GitHub repository, the GitHub API fast path returns 404 and pixi falls back to shelling out to git fetch. Without GIT_TERMINAL_PROMPT=0, git reaches for the controlling TTY to prompt for HTTPS credentials and hangs forever on cmd.output(). Setting the env var makes git fail fast with a normal error.

While in the area, also stop using error_for_status_ref()? in github_fast_path. The fast path is just an optimization, so any non-success status (404 missing repo, 422 unresolvable rev, 403 rate-limit, 5xx) should cleanly return Indeterminate and let the caller fall back to a real fetch instead of bubbling an error up only to be swallowed at the call site. The trailing Indeterminate branch was effectively dead code before this change.

Fixes #5503

How Has This Been Tested?

  • cargo build -p pixi_git succeeds.
  • cargo test -p pixi_git --lib passes (4/4).
  • Reproducing the original hang against https://github.com/crosaderky/cpython (a 404 repo) now surfaces a normal git error instead of hanging indefinitely on the credential prompt.

AI Disclosure

  • This PR contains AI-generated content.
    • I have tested any AI-generated content in my PR.
    • I take responsibility for any AI-generated content in my PR.

Tools: Claude (Claude Code)

Checklist:

  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas

When a host- or source-dependency points at a non-existent GitHub
repository, the GitHub API fast path returns 404 and we fall back to
shelling out to `git fetch`. Without `GIT_TERMINAL_PROMPT=0`, git
reaches for the controlling TTY to prompt for HTTPS credentials and
hangs forever on `cmd.output()`. Set the env var so git fails fast
with a normal error, matching uv-git's behaviour.

Also stop using `error_for_status_ref()?` in `github_fast_path`: the
fast path is just an optimization, so any non-success status (404,
422, 403, 5xx) should cleanly return `Indeterminate` and let the
caller try a real fetch instead of bubbling an error up only to be
swallowed at the call site.

Fixes prefix-dev#5503
@baszalmstra baszalmstra changed the title fix(git): set GIT_TERMINAL_PROMPT=0 so invalid git deps fail fast fix: set GIT_TERMINAL_PROMPT=0 so invalid git deps fail fast May 1, 2026
@baszalmstra baszalmstra requested review from nichmor and ruben-arts May 1, 2026 12:23
Copy link
Copy Markdown
Contributor

@hunger hunger left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense to me.

@baszalmstra baszalmstra merged commit cd0a2c4 into prefix-dev:main May 4, 2026
39 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.

Specifying an invalid git host dependency hangs

3 participants