gh50 dev branches not pushing#51
Merged
BenjiMilan merged 1 commit intodevelopfrom Apr 22, 2026
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
Fixes issue #50 where pushing develop (or master) could be skipped if the commit already existed on the remote in a different branch (e.g., a previously pushed feature branch), ensuring primary branches still push in that scenario.
Changes:
- Adjust push eligibility logic to only skip when the remote contains the commit for non-primary branches.
- Fix
Branchprimary-branch detection by using the publicis_primary_branch()method in__post_init__and renaming the method accordingly.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
src/sc/branching/commands/push.py |
Allows pushing primary branches even when the commit exists on the remote in another branch. |
src/sc/branching/branch.py |
Corrects primary-branch detection by calling the method and exposing it as is_primary_branch(). |
Comments suppressed due to low confidence (1)
src/sc/branching/branch.py:55
Branch.__post_init__now callsis_primary_branch(), butis_primary_branch()only treatsself.typeas aBranchType. There are call sites that constructBranchwith a string type (e.g.Branch(base_branch_type, base_name)incommands/start.pywherebase_branch_typecan be'develop'/'master'andbase_nameisNone). With the current implementation this will incorrectly be treated as non-primary and raiseValueError, breaking valid uses ofBranch('develop')/Branch('master'). Consider normalizingself.typetoBranchTypein__post_init__(when passed astr) or makeis_primary_branch()compare onstr(self.type)so it works for both enums and strings.
def __post_init__(self):
if not self.suffix and not self.is_primary_branch():
raise ValueError("Can't create non primary branch with no suffix.")
@property
def name(self) -> str:
if self.suffix:
return f"{self.type}/{self.suffix}"
return str(self.type)
def is_primary_branch(self) -> bool:
return self.type in {BranchType.DEVELOP, BranchType.MASTER}
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
37febe1 to
0e0af8c
Compare
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Closes #50
Due to check for remote commit existing when pushing branches, when merging a feature branch that was pushed back into develop, then pushing develop, this will cause that branch not to push as the commit already exists on the feature branch.