Skip to content

Commit c678f0c

Browse files
CopilotAArnott
andcommitted
Add documentation for backward-compatible error handling
- Clarify that unrecognized NBGV_GitEngine values are silently ignored - Document that this maintains backward compatibility - Explain valid values are LibGit2, Managed, and Disabled (case-sensitive) Co-authored-by: AArnott <[email protected]>
1 parent 70e226b commit c678f0c

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/NerdBank.GitVersioning/GitContext.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,8 @@ public string RepoRelativeProjectDirectory
141141
/// <returns>The engine to use.</returns>
142142
/// <remarks>
143143
/// If the NBGV_GitEngine environment variable is set, it takes precedence.
144+
/// Valid values are "LibGit2", "Managed", and "Disabled" (case-sensitive).
145+
/// Unrecognized values are treated as if the variable was not set, maintaining backward compatibility.
144146
/// Otherwise, if the DEPENDABOT environment variable is set to "true" (case-insensitive), returns <see cref="Engine.Disabled"/>.
145147
/// Otherwise, returns <paramref name="defaultEngine"/>.
146148
/// </remarks>
@@ -164,7 +166,9 @@ public static Engine GetEffectiveGitEngine(Engine defaultEngine = Engine.ReadOnl
164166
return Engine.ReadOnly;
165167
}
166168

167-
// If unrecognized value, fall through to default logic
169+
// If unrecognized value, fall through to default logic.
170+
// This maintains backward compatibility where invalid environment variable values
171+
// are silently ignored rather than causing build failures.
168172
}
169173

170174
// If we're in a Dependabot environment and NBGV_GitEngine is not set, automatically disable the git engine

0 commit comments

Comments
 (0)