@@ -30,6 +30,7 @@ func TestGetCommitListDisplayStrings(t *testing.T) {
30
30
commits []* models.Commit
31
31
branches []* models.Branch
32
32
currentBranchName string
33
+ hasUpdateRefConfig bool
33
34
fullDescription bool
34
35
cherryPickedCommitShaSet * set.Set [string ]
35
36
diffName string
@@ -106,6 +107,7 @@ func TestGetCommitListDisplayStrings(t *testing.T) {
106
107
{Name : "old-branch" , CommitHash : "sha4" , Head : false },
107
108
},
108
109
currentBranchName : "current-branch" ,
110
+ hasUpdateRefConfig : true ,
109
111
startIdx : 0 ,
110
112
length : 4 ,
111
113
showGraph : false ,
@@ -119,6 +121,52 @@ func TestGetCommitListDisplayStrings(t *testing.T) {
119
121
sha4 commit4
120
122
` ),
121
123
},
124
+ {
125
+ testName : "show local branch head for head commit if updateRefs is on" ,
126
+ commits : []* models.Commit {
127
+ {Name : "commit1" , Sha : "sha1" },
128
+ {Name : "commit2" , Sha : "sha2" },
129
+ },
130
+ branches : []* models.Branch {
131
+ {Name : "current-branch" , CommitHash : "sha1" , Head : true },
132
+ {Name : "other-branch" , CommitHash : "sha1" , Head : false },
133
+ },
134
+ currentBranchName : "current-branch" ,
135
+ hasUpdateRefConfig : true ,
136
+ startIdx : 0 ,
137
+ length : 2 ,
138
+ showGraph : false ,
139
+ bisectInfo : git_commands .NewNullBisectInfo (),
140
+ cherryPickedCommitShaSet : set .New [string ](),
141
+ now : time .Date (2020 , 1 , 1 , 0 , 0 , 0 , 0 , time .UTC ),
142
+ expected : formatExpected (`
143
+ sha1 * commit1
144
+ sha2 commit2
145
+ ` ),
146
+ },
147
+ {
148
+ testName : "don't show local branch head for head commit if updateRefs is off" ,
149
+ commits : []* models.Commit {
150
+ {Name : "commit1" , Sha : "sha1" },
151
+ {Name : "commit2" , Sha : "sha2" },
152
+ },
153
+ branches : []* models.Branch {
154
+ {Name : "current-branch" , CommitHash : "sha1" , Head : true },
155
+ {Name : "other-branch" , CommitHash : "sha1" , Head : false },
156
+ },
157
+ currentBranchName : "current-branch" ,
158
+ hasUpdateRefConfig : false ,
159
+ startIdx : 0 ,
160
+ length : 2 ,
161
+ showGraph : false ,
162
+ bisectInfo : git_commands .NewNullBisectInfo (),
163
+ cherryPickedCommitShaSet : set .New [string ](),
164
+ now : time .Date (2020 , 1 , 1 , 0 , 0 , 0 , 0 , time .UTC ),
165
+ expected : formatExpected (`
166
+ sha1 commit1
167
+ sha2 commit2
168
+ ` ),
169
+ },
122
170
{
123
171
testName : "show local branch head and tag if both exist" ,
124
172
commits : []* models.Commit {
@@ -356,6 +404,7 @@ func TestGetCommitListDisplayStrings(t *testing.T) {
356
404
s .commits ,
357
405
s .branches ,
358
406
s .currentBranchName ,
407
+ s .hasUpdateRefConfig ,
359
408
s .fullDescription ,
360
409
s .cherryPickedCommitShaSet ,
361
410
s .diffName ,
0 commit comments