File tree Expand file tree Collapse file tree 3 files changed +28
-0
lines changed
Expand file tree Collapse file tree 3 files changed +28
-0
lines changed Original file line number Diff line number Diff line change @@ -660,5 +660,19 @@ public void UnalteredFilesDontMarkIndexAsDirty()
660660 Assert . Equal ( 9 , status . Count ( ) ) ;
661661 }
662662 }
663+
664+ [ Fact ]
665+ public void TestUpdateIndexDoesNotFail ( )
666+ {
667+ var path = SandboxStandardTestRepo ( ) ;
668+
669+ using ( var repo = new Repository ( path ) )
670+ {
671+ // This option improves the performance of subsequent calls,
672+ // but there isn't really an observable difference to assert
673+ // Therefor enable the option and to ensure it doesn't trigger and exception is the only thing possible
674+ repo . RetrieveStatus ( new StatusOptions ( ) { UpdateIndex = true } ) ;
675+ }
676+ }
663677 }
664678}
Original file line number Diff line number Diff line change @@ -139,6 +139,12 @@ private static GitStatusOptions CreateStatusOptions(StatusOptions options)
139139 GitStatusOptionFlags . IncludeUnmodified ;
140140 }
141141
142+ if ( options . UpdateIndex )
143+ {
144+ coreOptions . Flags |=
145+ GitStatusOptionFlags . UpdateIndex ;
146+ }
147+
142148 return coreOptions ;
143149 }
144150
Original file line number Diff line number Diff line change @@ -105,5 +105,13 @@ public StatusOptions()
105105 /// Include untracked files when scanning for status
106106 /// </summary>
107107 public bool IncludeUntracked { get ; set ; }
108+
109+ /// <summary>
110+ /// Refresh out of date index and save it in index
111+ /// </summary>
112+ /// <remarks>
113+ /// Will result in less work being done in subsequent calls
114+ /// </remarks>
115+ public bool UpdateIndex { get ; set ; }
108116 }
109117}
You can’t perform that action at this time.
0 commit comments