feat(gitstore): add support for specifying git branch (via GITSTORE_G…#2298
Conversation
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request significantly enhances the gitstore component by introducing explicit support for specifying a Git branch. This allows the system to interact with different branches of a single remote repository, providing greater flexibility for managing various configurations or environments without requiring multiple repository instances. Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here. Footnotes
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: d32d5795f5
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
There was a problem hiding this comment.
Code Review
This pull request adds support for specifying a git branch for the git-based token store. The changes correctly propagate the new gitStoreBranch configuration from environment variables to the gitstore component, and update the clone and pull operations to use the specified branch. However, I found an issue in the logic for handling empty remote repositories where the specified branch is not used, causing commits to go to the default branch. I've added a comment with a suggested fix.
luispater
left a comment
There was a problem hiding this comment.
Summary:
This PR adds support for selecting a git branch for gitstore via GITSTORE_GIT_BRANCH, wiring the value from cmd/server/main.go into GitTokenStore and using it in clone/pull.
Blocking findings:
- Backward compatibility regression: the default branch is now hardcoded to
main(gitStoreBranch := "main"), so whenGITSTORE_GIT_BRANCHis not set, behavior no longer follows the remote default branch. Repos whose default branch is notmainmay fail on clone/pull with reference-not-found errors.
Non-blocking findings:
- No tests were added for branch selection behavior (unset branch, valid custom branch, nonexistent branch).
- Config/docs updates for
GITSTORE_GIT_BRANCHare missing.
Suggested fix:
- Keep default branch empty (or only apply branch override when env var is explicitly set and non-empty), so existing behavior remains unchanged unless users opt in.
- Add targeted tests for clone/pull behavior with and without explicit branch configuration.
Test plan:
- Unit/integration tests for
EnsureRepositorywith:- no branch configured (remote default branch),
- explicit branch configured,
- nonexistent branch configured (expected error path).
|
been busy for a while, will update the PR soon |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 4746f146db
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 6efd963c92
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
6efd963 to
058793c
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 058793c73a
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
|
hi @luispater , what do you think about this? |
luispater
left a comment
There was a problem hiding this comment.
Summary: The earlier hard-coded main regression is fixed. GITSTORE_GIT_BRANCH is now optional, and the new tests cover explicit branches, empty remotes, renamed defaults, and missing branches.
Blocking findings:
- None.
Non-blocking findings:
internal/store/gitstore.go:661-699resolves the remote default branch with both a fetch and a remote listing on every branch-unset reopen. That is correct, but it makes the common sync path more network-heavy.internal/store/gitstore.go:733-779intentionally falls back to the current branch when the remote default cannot be resolved because of auth or empty-remote errors. That preserves availability, but it can leave the workspace on a stale branch until a later successful sync.
Test plan:
- The added matrix covers the important branch-selection cases.
This is an automated Codex review result and still requires manual verification by a human reviewer.
Implement git branch checkout per #2090
Add GITSTORE_GIT_BRANCH to specify which branch to checkout & push, allowing multiple configuration for single repo, instead of creating multiple repo for each instance.