Skip to content

fix(releasekit): fix git push argument order for --set-upstream#4667

Open
yesudeep wants to merge 8 commits intomainfrom
yesudeep/fix/lethal-start
Open

fix(releasekit): fix git push argument order for --set-upstream#4667
yesudeep wants to merge 8 commits intomainfrom
yesudeep/fix/lethal-start

Conversation

@yesudeep
Copy link
Contributor

Problem

Run #22008381084 failed with:

RuntimeError: Failed to push release branch 'releasekit--release--py':
fatal: The current branch releasekit--release--py has no upstream branch.

The git push origin --set-upstream command has invalid argument order. Git requires --set-upstream before the remote, and the branch name must be explicitly specified as a refspec.

Fix

Changed git.py:push() from:

git push origin --set-upstream

to:

git push --set-upstream origin <branch>

The branch name is resolved via git branch --show-current.

Testing

All 1301 releasekit tests pass (83% coverage).

The command was 'git push origin --set-upstream' which is invalid.
Correct syntax: 'git push --set-upstream origin <branch>'.

The --set-upstream flag must come before the remote, and the branch
name must be explicitly specified as a refspec.
@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @yesudeep, 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 addresses a critical issue in the releasekit tool where the git push --set-upstream command was failing due to an incorrect argument order. The fix reorders the arguments and ensures the current branch name is explicitly provided, resolving release failures related to upstream branch configuration.

Highlights

  • Fix Git Push Argument Order: Corrected the argument order for the git push --set-upstream command within the releasekit tool to ensure proper upstream branch setting.
  • Explicit Branch Specification: Modified the push function to explicitly include the current branch name when using --set-upstream, as required by Git.

🧠 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.

Changelog
  • py/tools/releasekit/src/releasekit/backends/vcs/git.py
    • Fixed the argument order for the git push --set-upstream command.
    • Added logic to explicitly retrieve and include the current branch name when setting the upstream.
Activity
  • Identified a RuntimeError during a release run due to an invalid git push command.
  • Proposed a fix by reordering arguments for git push --set-upstream and explicitly adding the branch name.
  • Confirmed all 1301 releasekit tests pass with 83% coverage after applying the fix.
Using Gemini Code Assist

The 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 /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

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 .gemini/ folder in the base of the repository. Detailed instructions can be found here.

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.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request correctly fixes a bug in the git push command where the arguments for --set-upstream were in the wrong order. The change correctly reorders the arguments and adds the required branch name. The fix is effective and addresses the problem described. I have one minor suggestion to improve the code's readability by restructuring how the command arguments are assembled.

1. git.py: restructure push() per review feedback; skip --set-upstream
   for tag-only pushes (--set-upstream + --tags conflict)
2. github.py: add url to list_prs --json fields; use --body-file for
   create_pr to avoid shell argument size limits
3. github_api.py: add url to list_prs results; extract html_url from
   create_pr response instead of returning raw JSON
4. prepare.py: fall back to bootstrap_sha when per-package tag doesn't
   exist (bootstrapping issue on first release)
5. tags.py: make tag push failure fatal (raise RuntimeError)
6. commitback.py: make push failure fatal (raise RuntimeError)

All 1301 tests pass (83% coverage).
R1: github.py update_pr — use --body-file to avoid shell arg size limits
R2: git.py commit — fix git add -A logic (don't run add -A in dry_run)
R3: git.py delete_tag — return remote push failure instead of swallowing
R4: gitlab.py create_pr — use temp file for large MR descriptions
R5: bitbucket.py list_prs — add missing url field
R6: gitlab.py list_prs — add missing url field
R7: pnpm.py lock — don't discard check_only when upgrade_package is set

All 1301 tests pass (83% coverage).
Replace Path.unlink() with os.unlink() in async functions to avoid
blocking pathlib calls flagged by the ASYNC240 linter rule.
20 tests against real git repos (with bare remote):
- push --set-upstream on new branch
- push --tags (verifies no --set-upstream conflict)
- push set_upstream=False
- checkout_branch create/switch
- current_branch
- tag, tag_exists, list_tags, list_tags with pattern
- delete_tag local and remote (verifies remote failure propagation)
- log with since_tag, paths, max_commits
- diff_files since_tag
- commit with paths (partial stage), without paths (git add -A), dry_run
- is_shallow, default_branch

All 1321 tests pass (83% coverage).
45 integration tests exercising real CLI commands on temp repos:
- git (20): push, tags, branches, commit, log, diff, delete_tag
- uv (7): build, lock, lock --check, version_bump + dry-run variants
- pnpm (7): pack, lock, frozen-lockfile, npm version + dry-run variants
- gh (11): release create, pr create/update/merge, labels (dry-run)

Each test file uses shutil.which() skipif markers so tests warn and
skip locally when a tool is missing, but run in CI where all tools
are installed.

CI workflow (python.yml) updated to install pnpm, node, and gh CLI
in the tool-tests job.
@yesudeep yesudeep force-pushed the yesudeep/fix/lethal-start branch 2 times, most recently from ca06542 to 7d61f8c Compare February 14, 2026 03:09
@github-actions github-actions bot added the root label Feb 14, 2026
@yesudeep yesudeep force-pushed the yesudeep/fix/lethal-start branch 2 times, most recently from 09a9c1c to 963069f Compare February 14, 2026 03:35
@github-actions github-actions bot added the docs Improvements or additions to documentation label Feb 14, 2026
@yesudeep yesudeep force-pushed the yesudeep/fix/lethal-start branch 6 times, most recently from 6ab220b to d29cc74 Compare February 15, 2026 02:37
@yesudeep yesudeep force-pushed the yesudeep/fix/lethal-start branch 6 times, most recently from dc799e9 to a25560c Compare February 15, 2026 06:19
CI runners may have 'master' as the default branch. Explicitly set
'-b main' in both bare and work repos to ensure consistent behavior.
@yesudeep yesudeep force-pushed the yesudeep/fix/lethal-start branch from a25560c to d60e94a Compare February 15, 2026 06:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

config docs Improvements or additions to documentation fix python Python root

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

3 participants