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() {
return false
}
displayStatus := s.props.GetBool(FetchStatus, false)
if displayStatus {
s.setSvnStatus()
} else {
s.Working = &SvnStatus{}
}
s.setSvnStatus()
return true
}
@ -101,6 +98,12 @@ func (s *Svn) setSvnStatus() {
}
s.Working = &SvnStatus{}
displayStatus := s.props.GetBool(FetchStatus, false)
if !displayStatus {
return
}
changes := s.getSvnCommandOutput("status")
if len(changes) == 0 {
return

View file

@ -36,6 +36,8 @@ func TestSvnEnabledInWorkingDirectory(t *testing.T) {
env.On("GOOS").Return("")
env.On("FileContent", "/dir/hello/trunk").Return("")
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("HasParentFilePath", ".svn").Return(fileInfo, nil)
s := &Svn{
@ -239,8 +241,10 @@ R Moved.File`,
s := &Svn{
scm: scm{
env: env,
props: properties.Map{},
env: env,
props: properties.Map{
FetchStatus: true,
},
command: SVNCOMMAND,
},
}