mirror of
https://github.com/arl/gitmux.git
synced 2026-09-10 07:26:18 -04:00
Issue 32/branch format (#38)
* format/tmux: add failing test for issue 32 As exposed in the added failing test, reproducing the issue 32, the branch style only affect the branch symbol whereas it should affect both affect the symbol and the branch name. * format/tmux: branch style now affects both branch symbol+name Fixes #32 * Fix tests and adapt for new behavior
This commit is contained in:
parent
845f4165fe
commit
06654727b5
|
|
@ -240,12 +240,12 @@ func (f *Formater) currentRef() {
|
|||
f.clear()
|
||||
|
||||
if f.st.IsDetached {
|
||||
fmt.Fprintf(&f.b, "%s%s", f.Symbols.HashPrefix, f.st.HEAD)
|
||||
fmt.Fprintf(&f.b, "%s%s%s", f.Styles.Branch, f.Symbols.HashPrefix, f.st.HEAD)
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
fmt.Fprintf(&f.b, "%s",
|
||||
fmt.Fprintf(&f.b, "%s%s", f.Styles.Branch,
|
||||
truncateBranchName(f.st.LocalBranch, f.Options.BranchMaxLen, false))
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -256,7 +256,7 @@ func TestFormat(t *testing.T) {
|
|||
},
|
||||
},
|
||||
want: clear + "StyleBranchSymbolBranch" +
|
||||
clear + "Local" + ".." +
|
||||
clear + "StyleBranch" + "Local" + ".." +
|
||||
clear + "StyleRemoteRemote" +
|
||||
clear + " - " +
|
||||
clear + "StyleModSymbolMod2",
|
||||
|
|
@ -283,7 +283,7 @@ func TestFormat(t *testing.T) {
|
|||
},
|
||||
},
|
||||
want: clear + "StyleBranchSymbolBranch" +
|
||||
clear + "Local" + " ~~ " +
|
||||
clear + "StyleBranch" + "Local" + " ~~ " +
|
||||
clear + "StyleModSymbolMod2",
|
||||
},
|
||||
{
|
||||
|
|
@ -346,10 +346,27 @@ func TestFormat(t *testing.T) {
|
|||
},
|
||||
},
|
||||
want: clear + "StyleBranch" + "SymbolBranch" +
|
||||
clear + "branch..." + " " +
|
||||
clear + "StyleBranch" + "branch..." + " " +
|
||||
clear + "StyleRemote" + "remote/branch..." +
|
||||
clear,
|
||||
},
|
||||
{
|
||||
name: "issue-32",
|
||||
styles: styles{
|
||||
Branch: "StyleBranch",
|
||||
},
|
||||
symbols: symbols{
|
||||
Branch: "SymbolBranch",
|
||||
},
|
||||
layout: []string{"branch"},
|
||||
st: &gitstatus.Status{
|
||||
Porcelain: gitstatus.Porcelain{
|
||||
LocalBranch: "branchName",
|
||||
},
|
||||
},
|
||||
want: clear + "StyleBranch" + "SymbolBranch" +
|
||||
clear + "StyleBranch" + "branchName",
|
||||
},
|
||||
}
|
||||
for _, tc := range tests {
|
||||
tc := tc
|
||||
|
|
|
|||
2
testdata/default.output.golden
vendored
2
testdata/default.output.golden
vendored
|
|
@ -1 +1 @@
|
|||
#[fg=default]#[fg=default]#[fg=white,bold]⎇ #[fg=default]master..#[fg=default]#[fg=cyan]origin/master#[fg=default] ↑·1 - #[fg=default]#[fg=green,bold]● 1 #[fg=red,bold]✚ 1 #[fg=cyan,bold]⚑ 1 #[fg=magenta,bold]… 1
|
||||
#[fg=default]#[fg=default]#[fg=white,bold]⎇ #[fg=default]#[fg=white,bold]master..#[fg=default]#[fg=cyan]origin/master#[fg=default] ↑·1 - #[fg=default]#[fg=green,bold]● 1 #[fg=red,bold]✚ 1 #[fg=cyan,bold]⚑ 1 #[fg=magenta,bold]… 1
|
||||
Loading…
Reference in a new issue