-
-
Notifications
You must be signed in to change notification settings - Fork 177
Add NBGV_GitEngine=Disabled option #586
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 1 commit
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
4a2b7a8
https://github.com/dotnet/Nerdbank.GitVersioning/issues/568 WIP
m0sa 7a0eb2a
Touch up and rearrange tests
AArnott 655ea68
distinguishing DebuggerDisplay from NoGitContext
m0sa 06b5408
build version property should still get generated
m0sa 2242f7e
run additional assemblyinfo_ tests to run in disabled context
m0sa 23fc344
Merge remote-tracking branch 'origin/main' into disabling
AArnott 3d67583
Fix build breaks and move test classes into their own files
AArnott 2bf9b6c
Fix merge so that tests don't regress
AArnott File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
36 changes: 36 additions & 0 deletions
36
src/NerdBank.GitVersioning/DisabledGit/DisabledGitContext.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,36 @@ | ||
| #nullable enable | ||
|
|
||
| using System; | ||
| using System.Diagnostics; | ||
|
|
||
| namespace Nerdbank.GitVersioning | ||
| { | ||
| [DebuggerDisplay("{" + nameof(DebuggerDisplay) + ",nq}")] | ||
| internal class DisabledGitContext : GitContext | ||
| { | ||
| public DisabledGitContext(string workingTreePath) | ||
| : base(workingTreePath, null) | ||
| { | ||
| this.VersionFile = new DisabledGitVersionFile(this); | ||
| } | ||
|
|
||
| public override VersionFile VersionFile { get; } | ||
|
|
||
| public override string? GitCommitId => null; | ||
|
|
||
| public override bool IsHead => false; | ||
|
|
||
| public override DateTimeOffset? GitCommitDate => null; | ||
|
|
||
| public override string? HeadCanonicalName => null; | ||
|
|
||
| private string DebuggerDisplay => $"\"{this.WorkingTreePath}\" (no-git)"; | ||
|
|
||
| public override void ApplyTag(string name) => throw new NotSupportedException(); | ||
| public override void Stage(string path) => throw new NotSupportedException(); | ||
| public override string GetShortUniqueCommitId(int minLength) => "nerdbankdisabled"; | ||
| public override bool TrySelectCommit(string committish) => true; | ||
| internal override int CalculateVersionHeight(VersionOptions? committedVersion, VersionOptions? workingVersion) => 0; | ||
| internal override Version GetIdAsVersion(VersionOptions? committedVersion, VersionOptions? workingVersion, int versionHeight) => Version0; | ||
| } | ||
| } |
20 changes: 20 additions & 0 deletions
20
src/NerdBank.GitVersioning/DisabledGit/DisabledGitVersionFile.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| namespace Nerdbank.GitVersioning | ||
| { | ||
| using Validation; | ||
|
|
||
| internal class DisabledGitVersionFile : VersionFile | ||
| { | ||
| public DisabledGitVersionFile(GitContext context) | ||
| : base(context) | ||
| { | ||
| } | ||
|
|
||
| protected new DisabledGitContext Context => (DisabledGitContext)base.Context; | ||
|
|
||
| protected override VersionOptions GetVersionCore(out string actualDirectory) | ||
| { | ||
| actualDirectory = null; | ||
| return null; | ||
| } | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.