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 @@ -505,6 +505,22 @@ public void CanResetSearchPaths()
505
505
GlobalSettings . SetConfigSearchPaths ( ConfigurationLevel . Global , null ) ;
506
506
}
507
507
508
+ [ Fact ]
509
+ public void CanAppendToSearchPaths ( )
510
+ {
511
+ string appendMe = Path . Combine ( Constants . TemporaryReposPath , Path . GetRandomFileName ( ) ) ;
512
+ var prevPaths = GlobalSettings . GetConfigSearchPaths ( ConfigurationLevel . Global ) ;
513
+
514
+ // append using the special name $PATH
515
+ GlobalSettings . SetConfigSearchPaths ( ConfigurationLevel . Global , "$PATH" , appendMe ) ;
516
+
517
+ var currentPaths = GlobalSettings . GetConfigSearchPaths ( ConfigurationLevel . Global ) ;
518
+ Assert . Equal ( currentPaths , prevPaths . Concat ( new [ ] { appendMe } ) ) ;
519
+
520
+ // set it back to the default
521
+ GlobalSettings . SetConfigSearchPaths ( ConfigurationLevel . Global , null ) ;
522
+ }
523
+
508
524
[ Fact ]
509
525
public void CanRedirectConfigAccess ( )
510
526
{
Original file line number Diff line number Diff line change @@ -288,7 +288,11 @@ public static IEnumerable<string> GetConfigSearchPaths(ConfigurationLevel level)
288
288
/// Set the paths under which libgit2 searches for the configuration file of a given level.
289
289
/// </summary>
290
290
/// <param name="level">The level (global/system/XDG) of the config.</param>
291
- /// <param name="paths">The new search paths, or null to reset to default.</param>
291
+ /// <param name="paths">
292
+ /// The new search paths to set.
293
+ /// Pass null to reset to the default.
294
+ /// The special string "$PATH" will be substituted with the current search path.
295
+ /// </param>
292
296
public static void SetConfigSearchPaths ( ConfigurationLevel level , params string [ ] paths )
293
297
{
294
298
var pathString = ( paths == null ) ? null : string . Join ( Path . PathSeparator . ToString ( ) , paths ) ;
You can’t perform that action at this time.
0 commit comments