Commit 5902577 1 parent 2f3dbab commit 5902577 Copy full SHA for 5902577
File tree 4 files changed +94
-12
lines changed
4 files changed +94
-12
lines changed Original file line number Diff line number Diff line change 83
83
hide_clean : false
84
84
# Swaps order of behind & ahead upstream counts - "↓·1↑·1" -> "↑·1↓·1"
85
85
swap_divergence : false
86
- space_between_divergence : false
86
+ divergence_space : false
Original file line number Diff line number Diff line change @@ -133,7 +133,7 @@ tmux:
133
133
ellipsis : …
134
134
hide_clean : false
135
135
swap_divergence : false
136
- space_between_divergence : false
136
+ divergence_space : false
137
137
` ` `
138
138
139
139
First, save the default configuration to a new file:
@@ -272,7 +272,7 @@ This is the list of additional configuration `options`:
272
272
| `ellipsis` | Character to show branch name has been truncated | `…` |
273
273
| `hide_clean` | Hides the clean flag entirely | `false` |
274
274
| `swap_divergence` | Swaps order of behind & ahead upstream counts | `false` |
275
- | `space_between_divergence` | Add space between behind & ahead upstream counts | `false` |
275
+ | `divergence_space` | Add space between behind & ahead upstream counts | `false` |
276
276
277
277
278
278
# # Troubleshooting
Original file line number Diff line number Diff line change @@ -85,12 +85,12 @@ func (d *direction) UnmarshalYAML(value *yaml.Node) error {
85
85
}
86
86
87
87
type options struct {
88
- BranchMaxLen int `yaml:"branch_max_len"`
89
- BranchTrim direction `yaml:"branch_trim"`
90
- Ellipsis string `yaml:"ellipsis"`
91
- HideClean bool `yaml:"hide_clean"`
92
- SpaceBetweenDivergence bool `yaml:"space_between_divergence "`
93
- SwapDivergence bool `yaml:"swap_divergence"`
88
+ BranchMaxLen int `yaml:"branch_max_len"`
89
+ BranchTrim direction `yaml:"branch_trim"`
90
+ Ellipsis string `yaml:"ellipsis"`
91
+ HideClean bool `yaml:"hide_clean"`
92
+ DivergenceSpace bool `yaml:"divergence_space "`
93
+ SwapDivergence bool `yaml:"swap_divergence"`
94
94
}
95
95
96
96
// A Formater formats git status to a tmux style string.
@@ -246,12 +246,12 @@ func (f *Formater) divergence() string {
246
246
247
247
behind := ""
248
248
ahead := ""
249
- space := ""
249
+ space := ""
250
250
251
251
s := f .Styles .Clear + f .Styles .Divergence
252
252
if f .st .BehindCount != 0 {
253
- if f .Options .SpaceBetweenDivergence {
254
- space = " "
253
+ if f .Options .DivergenceSpace {
254
+ space = " "
255
255
}
256
256
behind = fmt .Sprintf ("%s%d" , f .Symbols .Behind , f .st .BehindCount )
257
257
}
Original file line number Diff line number Diff line change @@ -181,6 +181,88 @@ func TestDivergence(t *testing.T) {
181
181
},
182
182
want : "StyleClear" + "↑·128↓·41" ,
183
183
},
184
+ {
185
+ name : "space between behind only" ,
186
+ styles : styles {
187
+ Clear : "StyleClear" ,
188
+ },
189
+ symbols : symbols {
190
+ Ahead : "↓·" ,
191
+ Behind : "↑·" ,
192
+ },
193
+ options : options {
194
+ DivergenceSpace : true ,
195
+ },
196
+ st : & gitstatus.Status {
197
+ Porcelain : gitstatus.Porcelain {
198
+ AheadCount : 0 ,
199
+ BehindCount : 12 ,
200
+ },
201
+ },
202
+ want : "StyleClear" + "↑·12" ,
203
+ },
204
+ {
205
+ name : "space between diverged both way" ,
206
+ styles : styles {
207
+ Clear : "StyleClear" ,
208
+ },
209
+ symbols : symbols {
210
+ Ahead : "↓·" ,
211
+ Behind : "↑·" ,
212
+ },
213
+ options : options {
214
+ DivergenceSpace : true ,
215
+ SwapDivergence : false
216
+ },
217
+ st : & gitstatus.Status {
218
+ Porcelain : gitstatus.Porcelain {
219
+ AheadCount : 41 ,
220
+ BehindCount : 128 ,
221
+ },
222
+ },
223
+ want : "StyleClear" + "↑·128 ↓·41" ,
224
+ },
225
+ {
226
+ name : "space between swap divergence both ways" ,
227
+ styles : styles {
228
+ Clear : "StyleClear" ,
229
+ },
230
+ symbols : symbols {
231
+ Ahead : "↓·" ,
232
+ Behind : "↑·" ,
233
+ },
234
+ options : options {
235
+ DivergenceSpace : true ,
236
+ SwapDivergence : true ,
237
+ },
238
+ st : & gitstatus.Status {
239
+ Porcelain : gitstatus.Porcelain {
240
+ AheadCount : 41 ,
241
+ BehindCount : 128 ,
242
+ },
243
+ },
244
+ want : "StyleClear" + "↓·41 ↑·128" ,
245
+ },
246
+ {
247
+ name : "no space between diverged both way" ,
248
+ styles : styles {
249
+ Clear : "StyleClear" ,
250
+ },
251
+ symbols : symbols {
252
+ Ahead : "↓·" ,
253
+ Behind : "↑·" ,
254
+ },
255
+ options : options {
256
+ DivergenceSpace : false ,
257
+ },
258
+ st : & gitstatus.Status {
259
+ Porcelain : gitstatus.Porcelain {
260
+ AheadCount : 41 ,
261
+ BehindCount : 128 ,
262
+ },
263
+ },
264
+ want : "StyleClear" + "↑·128↓·41" ,
265
+ },
184
266
{
185
267
name : "swap divergence ahead only" ,
186
268
styles : styles {
You can’t perform that action at this time.
0 commit comments