@@ -28,14 +28,33 @@ public bool DiscardLocalChanges
28
28
public bool CheckoutAfterCreated
29
29
{
30
30
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
+ }
32
39
}
33
40
34
41
public bool IsBareRepository
35
42
{
36
43
get => _repo . IsBare ;
37
44
}
38
45
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
+
39
58
public CreateBranch ( Repository repo , Models . Branch branch )
40
59
{
41
60
_repo = repo ;
@@ -48,6 +67,7 @@ public CreateBranch(Repository repo, Models.Branch branch)
48
67
49
68
BasedOn = branch ;
50
69
DiscardLocalChanges = false ;
70
+ IsRecurseSubmoduleVisible = repo . Submodules . Count > 0 ;
51
71
}
52
72
53
73
public CreateBranch ( Repository repo , Models . Commit commit )
@@ -57,6 +77,7 @@ public CreateBranch(Repository repo, Models.Commit commit)
57
77
58
78
BasedOn = commit ;
59
79
DiscardLocalChanges = false ;
80
+ IsRecurseSubmoduleVisible = repo . Submodules . Count > 0 ;
60
81
}
61
82
62
83
public CreateBranch ( Repository repo , Models . Tag tag )
@@ -66,6 +87,7 @@ public CreateBranch(Repository repo, Models.Tag tag)
66
87
67
88
BasedOn = tag ;
68
89
DiscardLocalChanges = false ;
90
+ IsRecurseSubmoduleVisible = repo . Submodules . Count > 0 ;
69
91
}
70
92
71
93
public static ValidationResult ValidateBranchName ( string name , ValidationContext ctx )
@@ -92,6 +114,7 @@ public override Task<bool> Sure()
92
114
var log = _repo . CreateLog ( $ "Create Branch '{ fixedName } '") ;
93
115
Use ( log ) ;
94
116
117
+ var updateSubmodules = IsRecurseSubmoduleVisible && RecurseSubmodules ;
95
118
return Task . Run ( ( ) =>
96
119
{
97
120
bool succ ;
@@ -119,7 +142,7 @@ public override Task<bool> Sure()
119
142
}
120
143
}
121
144
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 ) ;
123
146
if ( needPopStash )
124
147
new Commands . Stash ( _repo . FullPath ) . Use ( log ) . Pop ( "stash@{0}" ) ;
125
148
}
0 commit comments