@@ -345,6 +345,28 @@ func Test_DefaultGitter_GetBranchFromTag(t *testing.T) {
345345 }
346346}
347347
348+ func Test_DefaultGitter_GetBranchFromTag_PreservesSlashInBranchName (t * testing.T ) {
349+ repo := t .TempDir ()
350+ runGit (t , repo , nil , "init" , "-q" )
351+ runGit (t , repo , nil , "config" , "user.email" , "test@example.com" )
352+ runGit (t , repo , nil , "config" , "user.name" , "Test" )
353+ runGit (t , repo , nil , "checkout" , "-q" , "-b" , "rel/main" )
354+ commitAt (t , repo , "a.txt" , "a\n " , "c1" , "2020-01-01T00:00:00Z" )
355+ runGit (t , repo , nil , "tag" , "v1.0.0" )
356+
357+ dg , err := gitsemver .NewDefaultGitter ("git" , nil )
358+ if err != nil {
359+ t .Fatal (err )
360+ }
361+ branches , err := dg .GetBranchesFromTag (repo , "refs/tags/v1.0.0" )
362+ if err != nil {
363+ t .Fatal (err )
364+ }
365+ if slices .Compare (branches , []string {"rel/main" }) != 0 {
366+ t .Fatalf ("unexpected branches: %v" , branches )
367+ }
368+ }
369+
348370func Test_DefaultGitter_GetBuild (t * testing.T ) {
349371 dg , err := gitsemver .NewDefaultGitter ("git" , nil )
350372 if err != nil {
0 commit comments