Skip to content

Commit a04316d

Browse files
committed
Add more detailed documentation to GitExtensions.OpenGitRepo()
1 parent 83402f0 commit a04316d

File tree

1 file changed

+21
-1
lines changed

1 file changed

+21
-1
lines changed

src/NerdBank.GitVersioning/GitExtensions.cs

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -380,7 +380,27 @@ public static string FindLibGit2NativeBinaries(string basePath)
380380
/// Opens a <see cref="Repository"/> found at or above a specified path.
381381
/// </summary>
382382
/// <param name="pathUnderGitRepo">The path at or beneath the git repo root.</param>
383-
/// <param name="useDefaultConfigSearchPaths">Specifies whether to use default settings for looking up global and system settings.</param>
383+
/// <param name="useDefaultConfigSearchPaths">
384+
/// Specifies whether to use default settings for looking up global and system settings.
385+
/// <para>
386+
/// By default (<paramref name="useDefaultConfigSearchPaths"/> == <c>false</c>), the repository will be configured to only
387+
/// use the repository-level configuration ignoring system or user-level configuration (set using <c>git config --global</c>.
388+
/// Thus only settings explicitly set for the repo will be available.
389+
/// </para>
390+
/// <para>
391+
/// For example using <c>Repository.Configuration.Get{string}("user.name")</c> to get the user's name will
392+
/// return the value set in the repository config or <c>null</c> if the user name has not been explicitly set for the repository.
393+
/// </para>
394+
/// <para>
395+
/// When the caller specifies to use the default configuration search paths (<paramref name="useDefaultConfigSearchPaths"/> == <c>true</c>)
396+
/// both repository level and global configuration will be available to the repo as well.
397+
/// </para>
398+
/// <para>
399+
/// In this mode, using <c>Repository.Configuration.Get{string}("user.name")</c> will return the
400+
/// value set in the user's global git configuration unless set on the repository level,
401+
/// matching the behavior of the <c>git</c> command.
402+
/// </para>
403+
/// </param>
384404
/// <returns>The <see cref="Repository"/> found for the specified path, or <c>null</c> if no git repo is found.</returns>
385405
public static Repository OpenGitRepo(string pathUnderGitRepo, bool useDefaultConfigSearchPaths = false)
386406
{

0 commit comments

Comments
 (0)