Skip to content

Conversation

@BenjiMilan
Copy link
Contributor

Closes #18

Don't prepend branch prefix if provided. Sneaky edit on not gitflow init on Init if already inited.

@BenjiMilan BenjiMilan requested a review from TB-1993 January 8, 2026 15:20
@BenjiMilan BenjiMilan self-assigned this Jan 8, 2026
Copilot AI review requested due to automatic review settings January 8, 2026 15:20
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This pull request addresses issue #18 by improving branch handling and initialization behavior. The changes prevent duplicate gitflow initialization and add support for users to provide branch names with their type prefix (e.g., "feature/my-branch") which will be automatically stripped.

Key Changes:

  • Added guard to prevent re-initialization of gitflow when already enabled
  • Implemented automatic stripping of branch type prefix from user-provided branch names

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
src/sc/branching/commands/init.py Adds check to prevent gitflow re-initialization if already enabled
src/sc/branching/branching.py Strips branch type prefix from provided names for better UX

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +169 to +170
if name.startswith(f"{branch_type}/"):
name = name.split("/", 1)[1]
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.
Copy link

@TB-1993 TB-1993 left a comment

Choose a reason for hiding this comment

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

Ship it!

@BenjiMilan BenjiMilan merged commit 1dac1e4 into develop Jan 8, 2026
11 checks passed
@BenjiMilan BenjiMilan deleted the feature/gh18_dont_prepend_branch_prefix_if_provided branch January 8, 2026 16:41
@github-actions github-actions bot locked and limited conversation to collaborators Jan 8, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Feature: Don't prepend branch prefix if user provides it sc start

3 participants