@@ -28,14 +28,33 @@ public bool DiscardLocalChanges
2828 public bool CheckoutAfterCreated
2929 {
3030 get => _repo . Settings . CheckoutBranchOnCreateBranch ;
31- set => _repo . Settings . CheckoutBranchOnCreateBranch = value ;
31+ set
32+ {
33+ if ( _repo . Settings . CheckoutBranchOnCreateBranch != value )
34+ {
35+ _repo . Settings . CheckoutBranchOnCreateBranch = value ;
36+ OnPropertyChanged ( ) ;
37+ }
38+ }
3239 }
3340
3441 public bool IsBareRepository
3542 {
3643 get => _repo . IsBare ;
3744 }
3845
46+ public bool IsRecurseSubmoduleVisible
47+ {
48+ get ;
49+ private set ;
50+ }
51+
52+ public bool RecurseSubmodules
53+ {
54+ get => _repo . Settings . UpdateSubmodulesOnCheckoutBranch ;
55+ set => _repo . Settings . UpdateSubmodulesOnCheckoutBranch = value ;
56+ }
57+
3958 public CreateBranch ( Repository repo , Models . Branch branch )
4059 {
4160 _repo = repo ;
@@ -48,6 +67,7 @@ public CreateBranch(Repository repo, Models.Branch branch)
4867
4968 BasedOn = branch ;
5069 DiscardLocalChanges = false ;
70+ IsRecurseSubmoduleVisible = repo . Submodules . Count > 0 ;
5171 }
5272
5373 public CreateBranch ( Repository repo , Models . Commit commit )
@@ -57,6 +77,7 @@ public CreateBranch(Repository repo, Models.Commit commit)
5777
5878 BasedOn = commit ;
5979 DiscardLocalChanges = false ;
80+ IsRecurseSubmoduleVisible = repo . Submodules . Count > 0 ;
6081 }
6182
6283 public CreateBranch ( Repository repo , Models . Tag tag )
@@ -66,6 +87,7 @@ public CreateBranch(Repository repo, Models.Tag tag)
6687
6788 BasedOn = tag ;
6889 DiscardLocalChanges = false ;
90+ IsRecurseSubmoduleVisible = repo . Submodules . Count > 0 ;
6991 }
7092
7193 public static ValidationResult ValidateBranchName ( string name , ValidationContext ctx )
@@ -92,6 +114,7 @@ public override Task<bool> Sure()
92114 var log = _repo . CreateLog ( $ "Create Branch '{ fixedName } '") ;
93115 Use ( log ) ;
94116
117+ var updateSubmodules = IsRecurseSubmoduleVisible && RecurseSubmodules ;
95118 return Task . Run ( ( ) =>
96119 {
97120 bool succ ;
@@ -119,7 +142,7 @@ public override Task<bool> Sure()
119142 }
120143 }
121144
122- succ = new Commands . Checkout ( _repo . FullPath ) . Use ( log ) . Branch ( fixedName , _baseOnRevision ) ;
145+ succ = new Commands . Checkout ( _repo . FullPath ) . Use ( log ) . Branch ( fixedName , _baseOnRevision , updateSubmodules ) ;
123146 if ( needPopStash )
124147 new Commands . Stash ( _repo . FullPath ) . Use ( log ) . Pop ( "stash@{0}" ) ;
125148 }
0 commit comments