@@ -514,45 +514,42 @@ void filesystem_supports_descriptor() throws Exception {
514514 public void calculate_head_name_with_env () throws Exception {
515515 String remote = "origin" ;
516516 HeadNameResult result1 = HeadNameResult .calculate (new BranchSpec ("${BRANCH}" ), null , null , new EnvVars ("BRANCH" , "master-a" ), remote );
517- assertEquals ("master-a" , result1 .headName );
517+ assertEquals ("refs/remotes/origin/ master-a" , result1 .remoteHeadName );
518518 assertTrue (result1 .refspec .startsWith ("+" + Constants .R_HEADS ));
519519
520520 HeadNameResult result2 = HeadNameResult .calculate (new BranchSpec ("${BRANCH}" ), null , null , new EnvVars ("BRANCH" , "refs/heads/master-b" ), remote );
521- assertEquals ("master-b" , result2 .headName );
521+ assertEquals ("refs/remotes/origin/ master-b" , result2 .remoteHeadName );
522522 assertTrue (result2 .refspec .startsWith ("+" + Constants .R_HEADS ));
523523
524524 HeadNameResult result3 = HeadNameResult .calculate (new BranchSpec ("refs/heads/${BRANCH}" ), null , null , new EnvVars ("BRANCH" , "master-c" ), remote );
525- assertEquals ("master-c" , result3 .headName );
525+ assertEquals ("refs/remotes/origin/ master-c" , result3 .remoteHeadName );
526526 assertTrue (result3 .refspec .startsWith ("+" + Constants .R_HEADS ));
527527
528528 HeadNameResult result4 = HeadNameResult .calculate (new BranchSpec ("${BRANCH}" ), null , null , null , remote );
529- assertEquals ("${BRANCH}" , result4 .headName );
529+ assertEquals ("refs/remotes/origin/ ${BRANCH}" , result4 .remoteHeadName );
530530 assertTrue (result4 .refspec .startsWith ("+" + Constants .R_HEADS ));
531531
532532 HeadNameResult result5 = HeadNameResult .calculate (new BranchSpec ("*/${BRANCH}" ), null , null , new EnvVars ("BRANCH" , "master-d" ), remote );
533- assertEquals ("master-d" , result5 .headName );
533+ assertEquals ("refs/remotes/origin/ master-d" , result5 .remoteHeadName );
534534 assertTrue (result5 .refspec .startsWith ("+" + Constants .R_HEADS ));
535535
536536 HeadNameResult result6 = HeadNameResult .calculate (new BranchSpec ("*/master-e" ), null , null , new EnvVars ("BRANCH" , "dummy" ), remote );
537- assertEquals ("master-e" , result6 .headName );
537+ assertEquals ("refs/remotes/origin/ master-e" , result6 .remoteHeadName );
538538 assertTrue (result6 .refspec .startsWith ("+" + Constants .R_HEADS ));
539539 }
540540
541541 @ Test
542542 public void calculate_head_name () throws Exception {
543543 String remote = "origin" ;
544544 HeadNameResult result1 = HeadNameResult .calculate (new BranchSpec ("branch" ), null , null , null , remote );
545- assertEquals ("branch" , result1 .headName );
546545 assertEquals ("refs/remotes/origin/branch" , result1 .remoteHeadName );
547546 assertEquals ("+refs/heads/branch:refs/remotes/origin/branch" , result1 .refspec );
548547
549548 HeadNameResult result2 = HeadNameResult .calculate (new BranchSpec ("refs/heads/branch" ), null , null , null , remote );
550- assertEquals ("branch" , result2 .headName );
551549 assertEquals ("refs/remotes/origin/branch" , result2 .remoteHeadName );
552550 assertEquals ("+refs/heads/branch:refs/remotes/origin/branch" , result2 .refspec );
553551
554552 HeadNameResult result3 = HeadNameResult .calculate (new BranchSpec ("refs/tags/my-tag" ), null , null , null , remote );
555- assertEquals ("my-tag" , result3 .headName );
556553 assertEquals ("my-tag" , result3 .remoteHeadName );
557554 assertEquals ("+refs/tags/my-tag:refs/tags/my-tag" , result3 .refspec );
558555 }
@@ -563,13 +560,11 @@ public void calculate_head_name_with_refspec_commit() throws Exception {
563560 String commit = "0123456789" + "0123456789" + "0123456789" + "0123456789" ;
564561 String branch = "branch" ;
565562 HeadNameResult result1 = HeadNameResult .calculate (new BranchSpec (commit ), null , branch , null , remote );
566- assertEquals (commit , result1 .headName );
567563 assertEquals (commit , result1 .remoteHeadName );
568564 assertEquals (branch , result1 .refspec );
569565
570566 HeadNameResult result2 = HeadNameResult .calculate (new BranchSpec ("${BRANCH}" ), null , "${REFSPEC}" ,
571567 new EnvVars ("BRANCH" , commit , "REFSPEC" , branch ), remote );
572- assertEquals (commit , result2 .headName );
573568 assertEquals (commit , result2 .remoteHeadName );
574569 assertEquals (branch , result2 .refspec );
575570 }
@@ -578,13 +573,11 @@ public void calculate_head_name_with_refspec_commit() throws Exception {
578573 public void calculate_head_name_with_refspec_FETCH_HEAD () throws Exception {
579574 String remote = "origin" ;
580575 HeadNameResult result1 = HeadNameResult .calculate (new BranchSpec (Constants .FETCH_HEAD ), null , "refs/changes/1/2/3" , null , remote );
581- assertEquals (Constants .FETCH_HEAD , result1 .headName );
582576 assertEquals (Constants .FETCH_HEAD , result1 .remoteHeadName );
583577 assertEquals ("refs/changes/1/2/3" , result1 .refspec );
584578
585579 HeadNameResult result2 = HeadNameResult .calculate (new BranchSpec ("${BRANCH}" ), null , "${REFSPEC}" ,
586580 new EnvVars ("BRANCH" , Constants .FETCH_HEAD , "REFSPEC" , "refs/changes/1/2/3" ), remote );
587- assertEquals (Constants .FETCH_HEAD , result2 .headName );
588581 assertEquals (Constants .FETCH_HEAD , result2 .remoteHeadName );
589582 assertEquals ("refs/changes/1/2/3" , result2 .refspec );
590583 }
@@ -600,7 +593,7 @@ void null_pointer_exception() throws Exception {
600593 AbstractGitSCMSource .SCMRevisionImpl rev260 =
601594 new AbstractGitSCMSource .SCMRevisionImpl (new SCMHead ("origin" ), git260 .getName ());
602595 HeadNameResult result1 = HeadNameResult .calculate (new BranchSpec ("master-f" ), rev260 , null , null , "origin" );
603- assertEquals ("master-f" , result1 .headName );
596+ assertEquals ("refs/remotes/origin/ master-f" , result1 .remoteHeadName );
604597 assertTrue (result1 .refspec .startsWith ("+" + Constants .R_HEADS ));
605598 }
606599}
0 commit comments