Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/sc/branching/branching.py
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,8 @@ def create_branch(
name: str | None = None
) -> Branch:
if name:
if name.startswith(f"{branch_type}/"):
name = name.split("/", 1)[1]
Comment on lines +169 to +170
Copy link

Copilot AI Jan 8, 2026

Choose a reason for hiding this comment

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

The branch prefix stripping logic doesn't handle the edge case where the provided name is just the prefix with a trailing slash (e.g., "feature/"). This would result in an empty string being passed to the Branch constructor, which will fail with a ValueError. Consider adding validation to check if the remaining name after stripping the prefix is non-empty before proceeding.

Copilot uses AI. Check for mistakes.
return Branch(branch_type, name)

if branch_type in {BranchType.DEVELOP, BranchType.MASTER}:
Expand Down
3 changes: 2 additions & 1 deletion src/sc/branching/commands/init.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@
@dataclass
class Init(Command):
def run_git_command(self):
GitFlowLibrary.init(self.top_dir)
if not GitFlowLibrary.is_gitflow_enabled(self.top_dir):
GitFlowLibrary.init(self.top_dir)

def run_repo_command(self):
Init.init_gitflow_for_manifest(self.top_dir)
Expand Down