Repository navigation
fix(push)!: publish the active branch to its configured upstream - #4
Merged
Merged
Conversation
Resolve the push destination from the branch's own git configuration (branch.<name>.remote and branch.<name>.merge) and publish only that branch with an explicit refspec, instead of always running `git push origin HEAD`. The remote name and the remote branch name are never assumed; the push never forces and never changes git config. Skip with a clear warning, inventing no destination, on a detached HEAD, a branch with no configured upstream, a local tracking ref (remote=.), or a missing remote. The local commit is always preserved. Replace pushToOrigin with pushCurrentBranch; the success message is now `Committed and pushed to <remote>/<remoteBranch>: <message>`. Add hermetic tests (local bare remotes, no network) and update README and CHANGELOG. BREAKING CHANGE: a branch with no configured upstream is no longer pushed to a remote named `origin`; it now resolves with a warning and a local commit. Configure an upstream (git push -u, or branch.<name>.merge) to publish.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Reworks the post-commit push in the
gitCommitaction so it publishes only the active branch to its configured upstream destination, instead of always runninggit push origin HEAD. The remote name and the remote branch name are read from git configuration, never assumed.Why
The old
pushToOriginassumed a remote literally namedoriginand a same-named remote branch. For clones whose remote isforgejo/github, or whose branch tracks a differently named remote branch, that pushed to a wrong or invented destination (origin/<same-name>). The action now honors the branch's own upstream.Behavior
branch.<name>.remote+branch.<name>.merge.git push <remote> refs/heads/<branch>:<mergeRef>— no other refs are pushed regardless ofpush.default.remote = .), or missing remote.Committed and pushed to <remote>/<remoteBranch>: <message>.Breaking change
A branch with no configured upstream is no longer pushed to a remote named
origin; it resolves with a warning and a local commit. Configure an upstream (git push -u, orbranch.<name>.merge) to publish.Tests
Hermetic, local bare remotes only (no network). RED observed, then GREEN. Cases: configured non-
originremote with a different remote branch name; no upstream (no fallback to origin); detached HEAD; missing configured remote; push failure with commit preserved.Verification
vitest run: 23/23tsupbuild: OKbiome check src test: cleanNotes
Native RDD review (due, high risk, item 3) could not run in this environment: the reviewer provider has no credentials. Functional checks above all pass; the external review remains pending, not a pass.