File tree Expand file tree Collapse file tree 2 files changed +30
-1
lines changed Expand file tree Collapse file tree 2 files changed +30
-1
lines changed Original file line number Diff line number Diff line change @@ -119,6 +119,27 @@ public void CanStageChangeInSubmoduleViaSubmoduleStage(string submodulePath)
119
119
}
120
120
}
121
121
122
+ [ Theory ]
123
+ [ InlineData ( "sm_changed_head" ) ]
124
+ // [InlineData("sm_changed_head/")] // AmbiguousSpecificationException - Do we want to support this?
125
+ public void CanStageChangeInSubmoduleViaIndexStage ( string submodulePath )
126
+ {
127
+ var path = BuildTemporarySubmoduleClone ( ) ;
128
+
129
+ using ( var repo = new Repository ( path ) )
130
+ {
131
+ var submodule = repo . Submodules [ submodulePath ] ;
132
+
133
+ var statusBefore = submodule . RetrieveStatus ( ) ;
134
+ Assert . Equal ( SubmoduleStatus . WorkDirModified , statusBefore & SubmoduleStatus . WorkDirModified ) ;
135
+
136
+ repo . Index . Stage ( submodulePath ) ;
137
+
138
+ var statusAfter = submodule . RetrieveStatus ( ) ;
139
+ Assert . Equal ( SubmoduleStatus . IndexModified , statusAfter & SubmoduleStatus . IndexModified ) ;
140
+ }
141
+ }
142
+
122
143
public string BuildTemporarySubmoduleClone ( )
123
144
{
124
145
var submodule = Path . Combine ( ResourcesDirectory . FullName , "submodule_wd" ) ;
Original file line number Diff line number Diff line change @@ -172,7 +172,15 @@ public virtual void Stage(IEnumerable<string> paths)
172
172
}
173
173
else
174
174
{
175
- AddToIndex ( relativePath ) ;
175
+ var submodule = repo . Submodules [ relativePath ] ;
176
+ if ( submodule != null )
177
+ {
178
+ submodule . Stage ( ) ;
179
+ }
180
+ else
181
+ {
182
+ AddToIndex ( relativePath ) ;
183
+ }
176
184
}
177
185
}
178
186
You can’t perform that action at this time.
0 commit comments