feat(svn): exclude branch info from fetch_status

resolves #3252
This commit is contained in:
Jan De Dobbeleer 2022-12-27 14:27:58 +01:00 committed by Jan De Dobbeleer
parent 9dd462c0d0
commit 2f1bf39253
2 changed files with 15 additions and 8 deletions

View file

@ -52,12 +52,9 @@ func (s *Svn) Enabled() bool {
if !s.shouldDisplay() { if !s.shouldDisplay() {
return false return false
} }
displayStatus := s.props.GetBool(FetchStatus, false)
if displayStatus { s.setSvnStatus()
s.setSvnStatus()
} else {
s.Working = &SvnStatus{}
}
return true return true
} }
@ -101,6 +98,12 @@ func (s *Svn) setSvnStatus() {
} }
s.Working = &SvnStatus{} s.Working = &SvnStatus{}
displayStatus := s.props.GetBool(FetchStatus, false)
if !displayStatus {
return
}
changes := s.getSvnCommandOutput("status") changes := s.getSvnCommandOutput("status")
if len(changes) == 0 { if len(changes) == 0 {
return return

View file

@ -36,6 +36,8 @@ func TestSvnEnabledInWorkingDirectory(t *testing.T) {
env.On("GOOS").Return("") env.On("GOOS").Return("")
env.On("FileContent", "/dir/hello/trunk").Return("") env.On("FileContent", "/dir/hello/trunk").Return("")
env.MockSvnCommand(fileInfo.Path, "", "info", "--tags", "--exact-match") env.MockSvnCommand(fileInfo.Path, "", "info", "--tags", "--exact-match")
env.On("RunCommand", "svn", []string{"info", "/dir/hello", "--show-item", "revision"}).Return("", nil)
env.On("RunCommand", "svn", []string{"info", "/dir/hello", "--show-item", "relative-url"}).Return("", nil)
env.On("IsWsl").Return(false) env.On("IsWsl").Return(false)
env.On("HasParentFilePath", ".svn").Return(fileInfo, nil) env.On("HasParentFilePath", ".svn").Return(fileInfo, nil)
s := &Svn{ s := &Svn{
@ -239,8 +241,10 @@ R Moved.File`,
s := &Svn{ s := &Svn{
scm: scm{ scm: scm{
env: env, env: env,
props: properties.Map{}, props: properties.Map{
FetchStatus: true,
},
command: SVNCOMMAND, command: SVNCOMMAND,
}, },
} }