File tree Expand file tree Collapse file tree 2 files changed +21
-1
lines changed Expand file tree Collapse file tree 2 files changed +21
-1
lines changed Original file line number Diff line number Diff line change @@ -483,6 +483,22 @@ public void CanResetSearchPaths()
483
483
GlobalSettings . SetConfigSearchPaths ( ConfigurationLevel . Global , null ) ;
484
484
}
485
485
486
+ [ Fact ]
487
+ public void CanAppendToSearchPaths ( )
488
+ {
489
+ string appendMe = Path . Combine ( Constants . TemporaryReposPath , Path . GetRandomFileName ( ) ) ;
490
+ var prevPaths = GlobalSettings . GetConfigSearchPaths ( ConfigurationLevel . Global ) ;
491
+
492
+ // append using the special name $PATH
493
+ GlobalSettings . SetConfigSearchPaths ( ConfigurationLevel . Global , "$PATH" , appendMe ) ;
494
+
495
+ var currentPaths = GlobalSettings . GetConfigSearchPaths ( ConfigurationLevel . Global ) ;
496
+ Assert . Equal ( currentPaths , prevPaths . Concat ( new [ ] { appendMe } ) ) ;
497
+
498
+ // set it back to the default
499
+ GlobalSettings . SetConfigSearchPaths ( ConfigurationLevel . Global , null ) ;
500
+ }
501
+
486
502
[ Fact ]
487
503
public void CanRedirectConfigAccess ( )
488
504
{
Original file line number Diff line number Diff line change @@ -219,7 +219,11 @@ public static IEnumerable<string> GetConfigSearchPaths(ConfigurationLevel level)
219
219
/// Set the paths under which libgit2 searches for the configuration file of a given level.
220
220
/// </summary>
221
221
/// <param name="level">The level (global/system/XDG) of the config.</param>
222
- /// <param name="paths">The new search paths, or null to reset to default.</param>
222
+ /// <param name="paths">
223
+ /// The new search paths to set.
224
+ /// Pass null to reset to the default.
225
+ /// The special string "$PATH" will be substituted with the current search path.
226
+ /// </param>
223
227
public static void SetConfigSearchPaths ( ConfigurationLevel level , params string [ ] paths )
224
228
{
225
229
var pathString = ( paths == null ) ? null : string . Join ( Path . PathSeparator . ToString ( ) , paths ) ;
You can’t perform that action at this time.
0 commit comments