1 foreach (config; EnumMembers!GitConfigLevel) 2 { 3 if (config != GitConfigLevel.system 4 && config != GitConfigLevel.xdg 5 && config != GitConfigLevel.global) 6 { 7 assertThrown!GitException(getSearchPaths(config)); 8 assertThrown!GitException(setSearchPaths(config, [])); 9 continue; 10 } 11 else 12 { 13 auto oldPaths = getSearchPaths(config); 14 scope(exit) setSearchPaths(config, oldPaths); 15 16 auto newPaths = ["/foo", "$PATH", "/foo/bar"]; 17 setSearchPaths(config, newPaths); 18 19 auto chained = newPaths[0] ~ oldPaths ~ newPaths[2]; 20 assert(getSearchPaths(config) == chained); 21 22 setSearchPaths(config, []); 23 assert(getSearchPaths(config) == oldPaths); 24 } 25 }
Set the search paths for a given level of config data.
Note: Use the magic path "$PATH" to include the old value of the path. This is useful for prepending or appending paths.
Note: Passing a null or empty array of paths will reset the paths to their defaults (based on environment variables).
Note: configLevel must be one of GitConfigLevel.system, GitConfigLevel.xdg, or GitConfigLevel.global.