Skip to content

Commit cbe0c81

Browse files
committed
Update version test
1 parent 871d13a commit cbe0c81

File tree

3 files changed

+15
-9
lines changed

3 files changed

+15
-9
lines changed

LibGit2Sharp.Tests/GlobalSettingsFixture.cs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,25 +19,25 @@ public void CanGetMinimumCompiledInFeatures()
1919
public void CanRetrieveValidVersionString()
2020
{
2121
// Version string format is:
22-
// Major.Minor.Patch[-somePreleaseTag]-libgit2_abbrev_hash (x86|x64 - features)
22+
// Major.Minor.Patch[-previewTag]+g{LibGit2Sharp_abbrev_hash}.libgit2-{libgit2_abbrev_hash} (x86|x64 - features)
2323
// Example output:
24-
// "0.17.0[-beta]+gdeadcafeee.LibGit2-06d772d (x86 - Threads, Https)"
24+
// "0.25.0-preview.52+g871d13a67f.libgit2-15e1193 (x86 - Threads, Https)"
2525

2626
string versionInfo = GlobalSettings.Version.ToString();
2727

2828
// The GlobalSettings.Version returned string should contain :
29-
// version: '0.17.0[-somePreleaseTag]+[gSomeGitCommit.]LibGit2-06d772d' LibGit2Sharp version number.
30-
// git2hash: '06d772d' LibGit2 library hash.
31-
// arch: 'x86' or 'x64' LibGit2 target.
32-
// git2Features: 'Threads, Ssh' LibGit2 features compiled with.
33-
string regex = @"^(?<version>\d+\.\d+\.\d+(-[\w\-\.]+)?\+(g(?<git2SharpHash>[a-f0-9]{10})\.)?LibGit2-[a-f0-9]{7}) \((?<arch>\w+) - (?<git2Features>(?:\w*(?:, )*\w+)*)\)$";
29+
// version: '0.25.0[-previewTag]' LibGit2Sharp version number.
30+
// git2SharpHash: '871d13a67f' LibGit2Sharp hash.
31+
// arch: 'x86' or 'x64' libgit2 target.
32+
// git2Features: 'Threads, Ssh' libgit2 features compiled with.
33+
string regex = @"^(?<version>\d+\.\d+\.\d+(-[\w\-\.]+)?\+(g(?<git2SharpHash>[a-f0-9]{10})\.)?libgit2-[a-f0-9]{7}) \((?<arch>\w+) - (?<git2Features>(?:\w*(?:, )*\w+)*)\)$";
3434

3535
Assert.NotNull(versionInfo);
3636

3737
Match regexResult = Regex.Match(versionInfo, regex);
3838

3939
Assert.True(regexResult.Success, "The following version string format is enforced:" +
40-
"Major.Minor.Patch[-somePreleaseTag]+[gSomeGitCommit].LibGit2-abbrev_hash (x86|x64 - features). " +
40+
"Major.Minor.Patch[-previewTag]+g{LibGit2Sharp_abbrev_hash}.libgit2-{libgit2_abbrev_hash} (x86|x64 - features). " +
4141
"But found \"" + versionInfo + "\" instead.");
4242
}
4343

LibGit2Sharp/BuiltInFeatures.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,5 +29,11 @@ public enum BuiltInFeatures
2929
/// libgit2.
3030
/// </summary>
3131
Ssh = (1 << 2),
32+
33+
/// <summary>
34+
/// Support for sub-second resolution in file modification times
35+
/// is compiled into libgit2.
36+
/// </summary>
37+
NSec = (1 << 3),
3238
}
3339
}

LibGit2Sharp/Version.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ private string RetrieveAbbrevShaFrom(string sha)
5555
/// </summary>
5656
/// <para>
5757
/// The format of the version number is as follows:
58-
/// <para>Major.Minor.Patch+g{LibGit2Sharp_abbrev_hash}.libgit2-{libgit2_abbrev_hash} (x86|x64 - features)</para>
58+
/// <para>Major.Minor.Patch[-previewTag]+g{LibGit2Sharp_abbrev_hash}.libgit2-{libgit2_abbrev_hash} (x86|x64 - features)</para>
5959
/// </para>
6060
/// <returns></returns>
6161
public override string ToString()

0 commit comments

Comments
 (0)