diff --git a/LibGit2Sharp.Tests/RepositoryFixture.cs b/LibGit2Sharp.Tests/RepositoryFixture.cs
index f493cf7ca..61c345db1 100644
--- a/LibGit2Sharp.Tests/RepositoryFixture.cs
+++ b/LibGit2Sharp.Tests/RepositoryFixture.cs
@@ -85,6 +85,14 @@ public void CanCreateStandardRepo()
}
}
+ [Fact]
+ public void CanRetrieveValidVersionString()
+ {
+ string versionInfo = Repository.Version;
+
+ Assert.NotNull(versionInfo);
+ }
+
[Fact]
public void CanCreateStandardRepoAndSpecifyAFolderWhichWillContainTheNewlyCreatedGitDirectory()
{
diff --git a/LibGit2Sharp/Core/GitBuiltInFeatures.cs b/LibGit2Sharp/Core/GitBuiltInFeatures.cs
new file mode 100644
index 000000000..4163b3186
--- /dev/null
+++ b/LibGit2Sharp/Core/GitBuiltInFeatures.cs
@@ -0,0 +1,18 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace LibGit2Sharp.Core
+{
+ ///
+ /// Flags to indentify libgit compiled features.
+ ///
+ [Flags]
+ internal enum GitBuiltInFeatures
+ {
+ Threads = (1 << 0),
+ Https = (1 << 1),
+ Ssh = (1 << 2),
+ }
+}
diff --git a/LibGit2Sharp/Core/NativeMethods.cs b/LibGit2Sharp/Core/NativeMethods.cs
index 0653503bd..e278e0a74 100644
--- a/LibGit2Sharp/Core/NativeMethods.cs
+++ b/LibGit2Sharp/Core/NativeMethods.cs
@@ -486,6 +486,9 @@ internal static extern int git_diff_find_similar(
[DllImport(libgit2)]
internal static extern IntPtr git_diff_get_delta(DiffSafeHandle diff, UIntPtr idx);
+ [DllImport(libgit2)]
+ internal static extern int git_libgit2_features();
+
[DllImport(libgit2)]
internal static extern int git_graph_ahead_behind(out UIntPtr ahead, out UIntPtr behind, RepositorySafeHandle repo, ref GitOid one, ref GitOid two);
diff --git a/LibGit2Sharp/Core/Proxy.cs b/LibGit2Sharp/Core/Proxy.cs
index e698d971b..a68d6af38 100644
--- a/LibGit2Sharp/Core/Proxy.cs
+++ b/LibGit2Sharp/Core/Proxy.cs
@@ -2721,6 +2721,24 @@ public static ObjectId git_treebuilder_write(RepositorySafeHandle repo, TreeBuil
#endregion
+ #region git_libgit2_
+
+ ///
+ /// Returns the features with which libgit2 was compiled.
+ ///
+ public static string git_libgit2_features()
+ {
+ GitBuiltInFeatures features;
+
+ int flags = NativeMethods.git_libgit2_features();
+
+ features = (GitBuiltInFeatures)Enum.ToObject(typeof(GitBuiltInFeatures), flags);
+
+ return features.ToString();
+ }
+
+ #endregion
+
private static ICollection git_foreach(
Func resultSelector,
Func, int> iterator,
diff --git a/LibGit2Sharp/LibGit2Sharp.csproj b/LibGit2Sharp/LibGit2Sharp.csproj
index e3c3ba0f7..566e40050 100644
--- a/LibGit2Sharp/LibGit2Sharp.csproj
+++ b/LibGit2Sharp/LibGit2Sharp.csproj
@@ -78,6 +78,7 @@
+
diff --git a/LibGit2Sharp/Repository.cs b/LibGit2Sharp/Repository.cs
index 1dea167c7..d428860c4 100644
--- a/LibGit2Sharp/Repository.cs
+++ b/LibGit2Sharp/Repository.cs
@@ -1011,7 +1011,7 @@ internal T RegisterForCleanup(T disposable) where T : IDisposable
/// Gets the current LibGit2Sharp version.
///
/// The format of the version number is as follows:
- /// Major.Minor.Patch-LibGit2Sharp_abbrev_hash-libgit2_abbrev_hash (x86|amd64)
+ /// Major.Minor.Patch-LibGit2Sharp_abbrev_hash-libgit2_abbrev_hash (x86|amd64 - capabilities)
///
///
public static string Version
@@ -1030,11 +1030,12 @@ private static string RetrieveVersion()
return string.Format(
CultureInfo.InvariantCulture,
- "{0}-{1}-{2} ({3})",
+ "{0}-{1}-{2} ({3} - {4})",
version.ToString(3),
libgit2sharpHash.Substring(0, 7),
libgit2Hash.Substring(0, 7),
- NativeMethods.ProcessorArchitecture
+ NativeMethods.ProcessorArchitecture,
+ Proxy.git_libgit2_features()
);
}