@@ -110,6 +110,33 @@ func TestInit_PrefixStoredInStack(t *testing.T) {
110110 assert .Equal (t , "feat" , sf .Stacks [0 ].Prefix )
111111}
112112
113+ func TestInit_PrefixAppliedToExplicitBranches (t * testing.T ) {
114+ gitDir := t .TempDir ()
115+ var created []string
116+ restore := git .SetOps (& git.MockOps {
117+ GitDirFn : func () (string , error ) { return gitDir , nil },
118+ DefaultBranchFn : func () (string , error ) { return "main" , nil },
119+ CurrentBranchFn : func () (string , error ) { return "main" , nil },
120+ CreateBranchFn : func (name , base string ) error {
121+ created = append (created , name )
122+ return nil
123+ },
124+ })
125+ defer restore ()
126+
127+ cfg , outR , errR := config .NewTestConfig ()
128+ runInit (cfg , & initOptions {branches : []string {"b1" , "b2" }, prefix : "feat" })
129+ output := collectOutput (cfg , outR , errR )
130+
131+ require .NotContains (t , output , "\u2717 " , "unexpected error" )
132+ assert .Equal (t , []string {"feat/b1" , "feat/b2" }, created , "branches should be created with prefix" )
133+
134+ sf , err := stack .Load (gitDir )
135+ require .NoError (t , err , "loading stack" )
136+ names := sf .Stacks [0 ].BranchNames ()
137+ assert .Equal (t , []string {"feat/b1" , "feat/b2" }, names , "stack should store prefixed branch names" )
138+ }
139+
113140func TestInit_RerereAlreadyEnabled (t * testing.T ) {
114141 gitDir := t .TempDir ()
115142 enableRerereCalled := false
0 commit comments