feat(git): support includeIf conditional config directives#296
Conversation
…ry context Thread a workingDir parameter through GetUser(), ExtractGitConfiguration(), and addGitSSHSigningKey() so that git config commands run in the workspace directory where includeIf "gitdir:..." directives are evaluated correctly. When workingDir is non-empty the --global flag is omitted and cmd.Dir is set instead, letting git resolve the full config chain including conditional includes. When workingDir is empty the previous --global behaviour is preserved, so callers without workspace context (e.g. initial setup) are unaffected. Closes devpod#750
✅ Deploy Preview for devsydev canceled.
|
|
Warning Rate limit exceeded
You’ve run out of usage credits. Purchase more in the billing tab. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the 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 configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (9)
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. Comment |
Summary
workingDirparameter throughGetUser(),ExtractGitConfiguration(), andaddGitSSHSigningKey()so git config commands run in the workspace directory whereincludeIf "gitdir:..."directives are evaluated correctlyworkingDiris non-empty, the--globalflag is omitted andcmd.Diris set instead, letting git resolve the full config chain including conditional includes; when empty, previous--globalbehavior is preservedGetUserandExtractGitConfigurationSpec alignment
The devcontainer specification does not prescribe how git configuration should be resolved or forwarded — this is left to implementors. VS Code's reference implementation copies the host
.gitconfigfile into the container, which meansincludeIfdirectives are preserved in the file but won't match inside the container (different paths).Devsy's approach is different and arguably more correct: it resolves git config values on the host — where
includeIf "gitdir:..."patterns can match the actual workspace path — then forwards the resolved values (user.name,user.email,user.signingkey,gpg.format) into the container. This ensures users with multiple git identities (e.g., personal vs. work repos) get the correct identity applied without any container-side path gymnastics.No deviations from spec: since the spec is silent on this topic, this implementation is fully compatible. The approach is strictly better than file-copying because it correctly evaluates conditional includes in their intended context.
Closes devpod#750