From 1e1ee3a53bc3bc0718e7f6236b56a126f010756f Mon Sep 17 00:00:00 2001 From: georgel Date: Sun, 23 Aug 2015 20:11:00 +0300 Subject: [PATCH 1/3] Unity ajustments --- LibGit2Sharp/Blob.cs | 4 +- LibGit2Sharp/Commit.cs | 12 +-- LibGit2Sharp/Configuration.cs | 5 +- LibGit2Sharp/Core/Ensure.cs | 2 +- LibGit2Sharp/Core/EnumExtensions.cs | 5 ++ LibGit2Sharp/Core/GitOdbBackend.cs | 3 +- LibGit2Sharp/Core/HistoryRewriter.cs | 2 +- LibGit2Sharp/Core/Platform.cs | 8 +- LibGit2Sharp/Core/Utils/Lazy.cs | 66 +++++++++++++++ LibGit2Sharp/Core/Utils/StreamExtensions.cs | 21 +++++ LibGit2Sharp/Core/Utils/Tuple.cs | 89 +++++++++++++++++++++ LibGit2Sharp/Filter.cs | 2 +- LibGit2Sharp/LibGit2Sharp.csproj | 18 ++--- LibGit2Sharp/NoteCollection.cs | 2 +- LibGit2Sharp/ReferenceCollection.cs | 2 +- LibGit2Sharp/Repository.cs | 2 +- LibGit2Sharp/Submodule.cs | 12 +-- LibGit2Sharp/TagAnnotation.cs | 8 +- LibGit2Sharp/Tree.cs | 6 +- 19 files changed, 229 insertions(+), 40 deletions(-) create mode 100644 LibGit2Sharp/Core/Utils/Lazy.cs create mode 100644 LibGit2Sharp/Core/Utils/StreamExtensions.cs create mode 100644 LibGit2Sharp/Core/Utils/Tuple.cs diff --git a/LibGit2Sharp/Blob.cs b/LibGit2Sharp/Blob.cs index 18f384799..fbbb20b69 100644 --- a/LibGit2Sharp/Blob.cs +++ b/LibGit2Sharp/Blob.cs @@ -22,8 +22,8 @@ protected Blob() internal Blob(Repository repo, ObjectId id) : base(repo, id) { - lazySize = GitObjectLazyGroup.Singleton(repo, id, Proxy.git_blob_rawsize); - lazyIsBinary = GitObjectLazyGroup.Singleton(repo, id, Proxy.git_blob_is_binary); + lazySize = GitObjectLazyGroup.Singleton(repo, id, Proxy.git_blob_rawsize); + lazyIsBinary = GitObjectLazyGroup.Singleton(repo, id, Proxy.git_blob_is_binary); } /// diff --git a/LibGit2Sharp/Commit.cs b/LibGit2Sharp/Commit.cs index 40429cd05..f63d35f4b 100644 --- a/LibGit2Sharp/Commit.cs +++ b/LibGit2Sharp/Commit.cs @@ -36,15 +36,15 @@ protected Commit() internal Commit(Repository repo, ObjectId id) : base(repo, id) { - lazyTree = GitObjectLazyGroup.Singleton(this.repo, id, obj => new Tree(this.repo, Proxy.git_commit_tree_id(obj), null)); + lazyTree = GitObjectLazyGroup.Singleton(this.repo, id, obj => new Tree(this.repo, Proxy.git_commit_tree_id(obj), null)); group1 = new GitObjectLazyGroup(this.repo, id); - lazyAuthor = group1.AddLazy(Proxy.git_commit_author); - lazyCommitter = group1.AddLazy(Proxy.git_commit_committer); + lazyAuthor = group1.AddLazy(Proxy.git_commit_author); + lazyCommitter = group1.AddLazy(Proxy.git_commit_committer); group2 = new GitObjectLazyGroup(this.repo, id); - lazyMessage = group2.AddLazy(Proxy.git_commit_message); - lazyMessageShort = group2.AddLazy(Proxy.git_commit_summary); - lazyEncoding = group2.AddLazy(RetrieveEncodingOf); + lazyMessage = group2.AddLazy(Proxy.git_commit_message); + lazyMessageShort = group2.AddLazy(Proxy.git_commit_summary); + lazyEncoding = group2.AddLazy(RetrieveEncodingOf); lazyNotes = new Lazy>(() => RetrieveNotesOfCommit(id).ToList()); diff --git a/LibGit2Sharp/Configuration.cs b/LibGit2Sharp/Configuration.cs index 3cce3610d..07ec1c504 100644 --- a/LibGit2Sharp/Configuration.cs +++ b/LibGit2Sharp/Configuration.cs @@ -102,7 +102,8 @@ private FilePath NormalizeConfigPath(FilePath path) return configPath; } - var gitConfigPath = Path.Combine(path.Native, ".git", "config"); + var gitConfigPath = Path.Combine(path.Native, ".git"); + gitConfigPath = Path.Combine(gitConfigPath, "config"); if (File.Exists(gitConfigPath)) { @@ -730,7 +731,7 @@ IEnumerator IEnumerable.GetEnumerator() private IEnumerable> BuildConfigEntries() { - return Proxy.git_config_foreach(configHandle, BuildConfigEntry); + return Proxy.git_config_foreach>(configHandle, BuildConfigEntry); } private static ConfigurationEntry BuildConfigEntry(IntPtr entryPtr) diff --git a/LibGit2Sharp/Core/Ensure.cs b/LibGit2Sharp/Core/Ensure.cs index e0da6413b..da6a920d6 100644 --- a/LibGit2Sharp/Core/Ensure.cs +++ b/LibGit2Sharp/Core/Ensure.cs @@ -49,7 +49,7 @@ public static void ArgumentNotNullOrEmptyString(string argumentValue, string arg { ArgumentNotNull(argumentValue, argumentName); - if (String.IsNullOrWhiteSpace (argumentValue)) + if (String.IsNullOrEmpty (argumentValue) || string.IsNullOrEmpty(argumentName.Replace(" ", ""))) { throw new ArgumentException("String cannot be empty", argumentName); } diff --git a/LibGit2Sharp/Core/EnumExtensions.cs b/LibGit2Sharp/Core/EnumExtensions.cs index faaf42642..f960475bf 100644 --- a/LibGit2Sharp/Core/EnumExtensions.cs +++ b/LibGit2Sharp/Core/EnumExtensions.cs @@ -10,5 +10,10 @@ public static bool HasAny(this Enum enumInstance, IEnumerable entries) { return entries.Any(enumInstance.HasFlag); } + + public static bool HasFlag(this Enum enumInstance, T entry) + { + return ((int)(object)enumInstance & (int)(object)entry) == (int)(object)(entry); + } } } diff --git a/LibGit2Sharp/Core/GitOdbBackend.cs b/LibGit2Sharp/Core/GitOdbBackend.cs index e36cdc531..1081b1e74 100644 --- a/LibGit2Sharp/Core/GitOdbBackend.cs +++ b/LibGit2Sharp/Core/GitOdbBackend.cs @@ -21,8 +21,9 @@ static GitOdbBackend() /// private readonly IntPtr Odb; +#if !UNITY_5 #pragma warning restore 169 - +#endif public read_callback Read; public read_prefix_callback ReadPrefix; public read_header_callback ReadHeader; diff --git a/LibGit2Sharp/Core/HistoryRewriter.cs b/LibGit2Sharp/Core/HistoryRewriter.cs index 784c1cc9c..514e5cdfb 100644 --- a/LibGit2Sharp/Core/HistoryRewriter.cs +++ b/LibGit2Sharp/Core/HistoryRewriter.cs @@ -57,7 +57,7 @@ public void Execute() // Ordering matters. In the case of `A -> B -> commit`, we need to make sure B is rewritten // before A. - foreach (var reference in refsToRewrite.OrderBy(ReferenceDepth)) + foreach (var reference in refsToRewrite.OrderBy(ReferenceDepth)) { // TODO: Rewrite refs/notes/* properly if (reference.CanonicalName.StartsWith("refs/notes/")) diff --git a/LibGit2Sharp/Core/Platform.cs b/LibGit2Sharp/Core/Platform.cs index d18613d29..399667f88 100644 --- a/LibGit2Sharp/Core/Platform.cs +++ b/LibGit2Sharp/Core/Platform.cs @@ -11,9 +11,15 @@ internal enum OperatingSystemType internal static class Platform { + static bool is64Bit() + { + string pa = System.Environment.GetEnvironmentVariable("PROCESSOR_ARCHITECTURE"); + return ((System.String.IsNullOrEmpty(pa) || pa.Substring(0, 3) == "x86") ? false : true); + } + public static string ProcessorArchitecture { - get { return Environment.Is64BitProcess ? "amd64" : "x86"; } + get { return is64Bit() ? "amd64" : "x86"; } } public static OperatingSystemType OperatingSystem diff --git a/LibGit2Sharp/Core/Utils/Lazy.cs b/LibGit2Sharp/Core/Utils/Lazy.cs new file mode 100644 index 000000000..fe164f7a7 --- /dev/null +++ b/LibGit2Sharp/Core/Utils/Lazy.cs @@ -0,0 +1,66 @@ +using System; +using System.Collections.Generic; + +namespace LibGit2Sharp +{ + /// + /// Provides support for lazy initialization. + /// + /// Specifies the type of object that is being lazily initialized. + public class Lazy + { + private readonly object padlock = new object(); + private readonly Func createValue; + private bool isValueCreated; + private T value; + + /// + /// Gets the lazily initialized value of the current Lazy{T} instance. + /// + public T Value { + get { + if (!isValueCreated) { + lock (padlock) { + if (!isValueCreated) { + value = createValue(); + isValueCreated = true; + } + } + } + return value; + } + } + + /// + /// Gets a value that indicates whether a value has been created for this Lazy{T} instance. + /// + public bool IsValueCreated { + get { + lock (padlock) { + return isValueCreated; + } + } + } + + /// + /// Initializes a new instance of the Lazy{T} class. + /// + /// The delegate that produces the value when it is needed. + public Lazy(Func createValue) + { + if (createValue == null) + throw new ArgumentNullException("createValue"); + + this.createValue = createValue; + } + + /// + /// Creates and returns a string representation of the Lazy{T}.Value. + /// + /// The string representation of the Lazy{T}.Value property. + public override string ToString() + { + return Value.ToString(); + } + } +} \ No newline at end of file diff --git a/LibGit2Sharp/Core/Utils/StreamExtensions.cs b/LibGit2Sharp/Core/Utils/StreamExtensions.cs new file mode 100644 index 000000000..81ec6a0e1 --- /dev/null +++ b/LibGit2Sharp/Core/Utils/StreamExtensions.cs @@ -0,0 +1,21 @@ +using System; +using System.IO; + +namespace LibGit2Sharp +{ + public static class StreamExtensions + { + public static void CopyTo(this Stream input, Stream output) + { + byte[] buffer = new byte[32768]; + while (true) + { + int read = input.Read (buffer, 0, buffer.Length); + if (read <= 0) + return; + output.Write (buffer, 0, read); + } + } + } +} + diff --git a/LibGit2Sharp/Core/Utils/Tuple.cs b/LibGit2Sharp/Core/Utils/Tuple.cs new file mode 100644 index 000000000..715d524d5 --- /dev/null +++ b/LibGit2Sharp/Core/Utils/Tuple.cs @@ -0,0 +1,89 @@ +using System; +using System.Collections.Generic; + +namespace LibGit2Sharp +{ + public sealed class Tuple + { + private readonly T1 item1; + private readonly T2 item2; + + /// + /// Retyurns the first element of the tuple + /// + public T1 Item1 { + get { return item1; } + } + + /// + /// Returns the second element of the tuple + /// + public T2 Item2 { + get { return item2; } + } + + /// + /// Create a new tuple value + /// + /// First element of the tuple + /// Second element of the tuple + public Tuple(T1 item1, T2 item2) + { + this.item1 = item1; + this.item2 = item2; + } + + public override string ToString() + { + return string.Format("Tuple({0}, {1})", Item1, Item2); + } + + public override int GetHashCode() + { + int hash = 17; + hash = hash * 23 + (item1 == null ? 0 : item1.GetHashCode()); + hash = hash * 23 + (item2 == null ? 0 : item2.GetHashCode()); + return hash; + } + + public override bool Equals(object o) + { + if (!(o is Tuple)) { + return false; + } + + var other = (Tuple)o; + + return this == other; + } + + public bool Equals(Tuple other) + { + return this == other; + } + + public static bool operator==(Tuple a, Tuple b) + { + if (object.ReferenceEquals(a, null)) { + return object.ReferenceEquals(b, null); + } + if (a.item1 == null && b.item1 != null) + return false; + if (a.item2 == null && b.item2 != null) + return false; + return + a.item1.Equals(b.item1) && + a.item2.Equals(b.item2); + } + + public static bool operator!=(Tuple a, Tuple b) + { + return !(a == b); + } + + public void Unpack(Action unpackerDelegate) + { + unpackerDelegate(Item1, Item2); + } + } +} \ No newline at end of file diff --git a/LibGit2Sharp/Filter.cs b/LibGit2Sharp/Filter.cs index 770471f6f..639cccad4 100644 --- a/LibGit2Sharp/Filter.cs +++ b/LibGit2Sharp/Filter.cs @@ -32,7 +32,7 @@ protected Filter(string name, IEnumerable attributes) this.name = name; this.attributes = attributes; - var attributesAsString = string.Join(",", this.attributes.Select(attr => attr.FilterDefinition)); + var attributesAsString = string.Join(",", this.attributes.Select(attr => attr.FilterDefinition).ToArray()); gitFilter = new GitFilter { diff --git a/LibGit2Sharp/LibGit2Sharp.csproj b/LibGit2Sharp/LibGit2Sharp.csproj index 195612b36..6b82437bb 100644 --- a/LibGit2Sharp/LibGit2Sharp.csproj +++ b/LibGit2Sharp/LibGit2Sharp.csproj @@ -11,32 +11,29 @@ Properties LibGit2Sharp LibGit2Sharp - v4.0 + v3.5 512 - - true + True full - false + False bin\Debug\ TRACE;DEBUG;NET40 prompt 4 - false - true + True AllRules.ruleset bin\Debug\LibGit2Sharp.xml pdbonly - true + True bin\Release\ TRACE prompt 4 - true - false + True bin\Release\LibGit2Sharp.xml @@ -380,6 +377,9 @@ + + + diff --git a/LibGit2Sharp/NoteCollection.cs b/LibGit2Sharp/NoteCollection.cs index c722221ce..4626a0c7f 100644 --- a/LibGit2Sharp/NoteCollection.cs +++ b/LibGit2Sharp/NoteCollection.cs @@ -65,7 +65,7 @@ public virtual string DefaultNamespace /// public virtual IEnumerable Namespaces { - get { return NamespaceRefs.Select(UnCanonicalizeName); } + get { return NamespaceRefs.Select(UnCanonicalizeName); } } internal IEnumerable NamespaceRefs diff --git a/LibGit2Sharp/ReferenceCollection.cs b/LibGit2Sharp/ReferenceCollection.cs index 4d2b9ece2..847d1b3e7 100644 --- a/LibGit2Sharp/ReferenceCollection.cs +++ b/LibGit2Sharp/ReferenceCollection.cs @@ -689,7 +689,7 @@ public virtual IEnumerable FromGlob(string pattern) { Ensure.ArgumentNotNullOrEmptyString(pattern, "pattern"); - return Proxy.git_reference_foreach_glob(repo.Handle, pattern, LaxUtf8Marshaler.FromNative) + return Proxy.git_reference_foreach_glob(repo.Handle, pattern, LaxUtf8Marshaler.FromNative) .Select(n => this[n]); } diff --git a/LibGit2Sharp/Repository.cs b/LibGit2Sharp/Repository.cs index 730da7eab..721718e1e 100644 --- a/LibGit2Sharp/Repository.cs +++ b/LibGit2Sharp/Repository.cs @@ -157,7 +157,7 @@ static public bool IsValid(string path) { Ensure.ArgumentNotNull(path, "path"); - if (string.IsNullOrWhiteSpace(path)) + if (String.IsNullOrEmpty (path) || string.IsNullOrEmpty(path.Replace(" ", ""))) { return false; } diff --git a/LibGit2Sharp/Submodule.cs b/LibGit2Sharp/Submodule.cs index ace995205..22a55c0df 100644 --- a/LibGit2Sharp/Submodule.cs +++ b/LibGit2Sharp/Submodule.cs @@ -39,14 +39,14 @@ internal Submodule(Repository repo, string name, string path, string url) this.url = url; var commitIds = new SubmoduleLazyGroup(repo, name); - headCommitId = commitIds.AddLazy(Proxy.git_submodule_head_id); - indexCommitId = commitIds.AddLazy(Proxy.git_submodule_index_id); - workdirCommitId = commitIds.AddLazy(Proxy.git_submodule_wd_id); + headCommitId = commitIds.AddLazy(Proxy.git_submodule_head_id); + indexCommitId = commitIds.AddLazy(Proxy.git_submodule_index_id); + workdirCommitId = commitIds.AddLazy(Proxy.git_submodule_wd_id); var rules = new SubmoduleLazyGroup(repo, name); - fetchRecurseSubmodulesRule = rules.AddLazy(Proxy.git_submodule_fetch_recurse_submodules); - ignoreRule = rules.AddLazy(Proxy.git_submodule_ignore); - updateRule = rules.AddLazy(Proxy.git_submodule_update_strategy); + fetchRecurseSubmodulesRule = rules.AddLazy(Proxy.git_submodule_fetch_recurse_submodules); + ignoreRule = rules.AddLazy(Proxy.git_submodule_ignore); + updateRule = rules.AddLazy(Proxy.git_submodule_update_strategy); } /// diff --git a/LibGit2Sharp/TagAnnotation.cs b/LibGit2Sharp/TagAnnotation.cs index 96ef697c0..14bc53823 100644 --- a/LibGit2Sharp/TagAnnotation.cs +++ b/LibGit2Sharp/TagAnnotation.cs @@ -22,8 +22,8 @@ protected TagAnnotation() internal TagAnnotation(Repository repo, ObjectId id) : base(repo, id) { - lazyName = GitObjectLazyGroup.Singleton(repo, id, Proxy.git_tag_name); - lazyTarget = GitObjectLazyGroup.Singleton(repo, + lazyName = GitObjectLazyGroup.Singleton(repo, id, Proxy.git_tag_name); + lazyTarget = GitObjectLazyGroup.Singleton(repo, id, obj => BuildFrom(repo, Proxy.git_tag_target_id(obj), @@ -31,8 +31,8 @@ internal TagAnnotation(Repository repo, ObjectId id) null)); group = new GitObjectLazyGroup(repo, id); - lazyTagger = group.AddLazy(Proxy.git_tag_tagger); - lazyMessage = group.AddLazy(Proxy.git_tag_message); + lazyTagger = group.AddLazy(Proxy.git_tag_tagger); + lazyMessage = group.AddLazy(Proxy.git_tag_message); } /// diff --git a/LibGit2Sharp/Tree.cs b/LibGit2Sharp/Tree.cs index 9ef5f1e8f..cba738de2 100644 --- a/LibGit2Sharp/Tree.cs +++ b/LibGit2Sharp/Tree.cs @@ -16,7 +16,7 @@ public class Tree : GitObject, IEnumerable { private readonly FilePath path; - private readonly ILazy lazyCount; + private readonly ILazy lazyCount; /// /// Needed for mocking purposes. @@ -29,13 +29,13 @@ internal Tree(Repository repo, ObjectId id, FilePath path) { this.path = path ?? ""; - lazyCount = GitObjectLazyGroup.Singleton(repo, id, Proxy.git_tree_entrycount); + lazyCount = GitObjectLazyGroup.Singleton(repo, id, Proxy.git_tree_entrycount); } /// /// Gets the number of immediately under this . /// - public virtual int Count { get { return lazyCount.Value; } } + public virtual int Count { get { return (int)lazyCount.Value; } } /// /// Gets the pointed at by the in this instance. From 1fc583663f30c6c0ea99182296cacf23e63c2374 Mon Sep 17 00:00:00 2001 From: georgel Date: Sun, 23 Aug 2015 21:17:46 +0300 Subject: [PATCH 2/3] Comment AggregateException in Proxy.cs --- LibGit2Sharp/Core/Proxy.cs | 79 +++++++++++++++++++------------------- 1 file changed, 40 insertions(+), 39 deletions(-) diff --git a/LibGit2Sharp/Core/Proxy.cs b/LibGit2Sharp/Core/Proxy.cs index c170cb392..24ad8dca0 100644 --- a/LibGit2Sharp/Core/Proxy.cs +++ b/LibGit2Sharp/Core/Proxy.cs @@ -52,43 +52,43 @@ private static void BuildErrorMessageFromException(StringBuilder sb, int level, string indent = new string(' ', level * 4); sb.AppendFormat("{0}{1}", indent, ex.Message); - if (ex is AggregateException) - { - AggregateException aggregateException = ((AggregateException)ex).Flatten(); - - if (aggregateException.InnerExceptions.Count == 1) - { - sb.AppendLine(); - sb.AppendLine(); - - sb.AppendFormat("{0}Contained Exception:{1}", indent, Environment.NewLine); - BuildErrorMessageFromException(sb, level + 1, aggregateException.InnerException); - } - else - { - sb.AppendLine(); - sb.AppendLine(); - - sb.AppendFormat("{0}Contained Exceptions:{1}", indent, Environment.NewLine); - for (int i = 0; i < aggregateException.InnerExceptions.Count; i++) - { - if (i != 0) - { - sb.AppendLine(); - sb.AppendLine(); - } - - BuildErrorMessageFromException(sb, level + 1, aggregateException.InnerExceptions[i]); - } - } - } - else if (ex.InnerException != null) - { - sb.AppendLine(); - sb.AppendLine(); - sb.AppendFormat("{0}Inner Exception:{1}", indent, Environment.NewLine); - BuildErrorMessageFromException(sb, level + 1, ex.InnerException); - } +// if (ex is AggregateException) +// { +// AggregateException aggregateException = ((AggregateException)ex).Flatten(); +// +// if (aggregateException.InnerExceptions.Count == 1) +// { +// sb.AppendLine(); +// sb.AppendLine(); +// +// sb.AppendFormat("{0}Contained Exception:{1}", indent, Environment.NewLine); +// BuildErrorMessageFromException(sb, level + 1, aggregateException.InnerException); +// } +// else +// { +// sb.AppendLine(); +// sb.AppendLine(); +// +// sb.AppendFormat("{0}Contained Exceptions:{1}", indent, Environment.NewLine); +// for (int i = 0; i < aggregateException.InnerExceptions.Count; i++) +// { +// if (i != 0) +// { +// sb.AppendLine(); +// sb.AppendLine(); +// } +// +// BuildErrorMessageFromException(sb, level + 1, aggregateException.InnerExceptions[i]); +// } +// } +// } +// else if (ex.InnerException != null) +// { +// sb.AppendLine(); +// sb.AppendLine(); +// sb.AppendFormat("{0}Inner Exception:{1}", indent, Environment.NewLine); +// BuildErrorMessageFromException(sb, level + 1, ex.InnerException); +// } } #endregion @@ -2190,7 +2190,8 @@ public static IEnumerable git_remote_ls(Repository repository, Remote directRefs.Add(name, new DirectReference(name, repository, remoteHead.Oid)); } - currentHead = IntPtr.Add(currentHead, IntPtr.Size); + //currentHead = IntPtr.Add(currentHead, IntPtr.Size); + currentHead = new IntPtr(currentHead.ToInt64() + IntPtr.Size); } for (int i = 0; i < symRefs.Count; i++) @@ -3141,7 +3142,7 @@ public static GitObjectType git_tree_entry_type(SafeHandle entry) return NativeMethods.git_tree_entry_type(entry); } - public static int git_tree_entrycount(GitObjectSafeHandle tree) + public static long git_tree_entrycount(GitObjectSafeHandle tree) { return (int)NativeMethods.git_tree_entrycount(tree); } From 61b9941c12615f61b4cd5510e9534415238017bc Mon Sep 17 00:00:00 2001 From: georgel Date: Sun, 23 Aug 2015 21:22:40 +0300 Subject: [PATCH 3/3] README.md --- README.md | 100 ++---------------------------------------------------- 1 file changed, 3 insertions(+), 97 deletions(-) diff --git a/README.md b/README.md index 692fc1012..2e178080b 100644 --- a/README.md +++ b/README.md @@ -1,99 +1,5 @@ -# LibGit2Sharp +# Fork from [LibGit2Sharp]:https://libgit2.github.com -**LibGit2Sharp brings all the might and speed of [libgit2][libgit2], a native Git implementation, to the managed world of .NET and Mono.** +Adjusted to be compiled for Unity3d - [libgit2]: http://libgit2.github.com/ - -## Prerequisites - - - **Windows:** .NET 4.0+ - - **Linux/Mac OS X:** Mono 3.6+ - -## Online resources - - - [NuGet package][nuget] (Requires NuGet 2.7+) - - [Source code][source] - - [nuget]: http://nuget.org/List/Packages/LibGit2Sharp - [source]: https://github.com/libgit2/libgit2sharp/ - -## Troubleshooting and support - - - Usage or programming related question? Post it on [StackOverflow][so] using the tag *libgit2sharp* - - Found a bug or missing a feature? Feed the [issue tracker][tracker] - - Announcements and related miscellanea through Twitter ([@libgit2sharp][twitter]) - - [so]: http://stackoverflow.com/questions/tagged/libgit2sharp - [tracker]: https://github.com/libgit2/libgit2sharp/issues - [twitter]: http://twitter.com/libgit2sharp - -## Current project status - -The CI builds are generously hosted and run on the [Travis][travis] and [AppVeyor][appveyor] infrastructures. - -| | Windows (x86/amd64) | Linux/Mac OS X | -| :------ | :------: | :------: | -| **master** | [![master win][master-win-badge]][master-win] | [![master nix][master-nix-badge]][master-nix] | -| **vNext** | [![vNext win][vNext-win-badge]][vNext-win] | [![vNext nix][vNext-nix-badge]][vNext-nix] | - -The security-oriented static code analysis is kindly run through the [Coverity][coverity] service. Code coverage is kindly run through [Coveralls.io][coveralls]. - -| | Static Analysis | Code Coverage | -|-------|-----------------|---------------| -| **vNext** | [![coverity][coverity-badge]][coverity-project] | [![coveralls][coveralls-badge]][coveralls-project] | - - - [travis]: https://travis-ci.org/ - [appveyor]: http://appveyor.com/ - [coverity]: https://scan.coverity.com/ - [coveralls]: https://coveralls.io/ - - [master-win-badge]: https://ci.appveyor.com/api/projects/status/8qxcoqdo9kp7x2w9/branch/master?svg=true - [master-win]: https://ci.appveyor.com/project/libgit2/libgit2sharp/branch/master - [master-nix-badge]: https://travis-ci.org/libgit2/libgit2sharp.svg?branch=master - [master-nix]: https://travis-ci.org/libgit2/libgit2sharp/branches - [vNext-win-badge]: https://ci.appveyor.com/api/projects/status/8qxcoqdo9kp7x2w9/branch/vNext?svg=true - [vNext-win]: https://ci.appveyor.com/project/libgit2/libgit2sharp/branch/vNext - [vNext-nix-badge]: https://travis-ci.org/libgit2/libgit2sharp.svg?branch=vNext - [vNext-nix]: https://travis-ci.org/libgit2/libgit2sharp/branches - - [coverity-project]: https://scan.coverity.com/projects/2088 - [coverity-badge]: https://scan.coverity.com/projects/2088/badge.svg - - [coveralls-project]: https://coveralls.io/r/libgit2/libgit2sharp?branch=vNext - [coveralls-badge]: https://coveralls.io/repos/libgit2/libgit2sharp/badge.svg?branch=vNext - -## Quick contributing guide - - - Fork and clone locally - - Create a topic specific branch. Add some nice feature. Do not forget the tests ;-) - - Send a Pull Request to spread the fun! - -More thorough information available in the [wiki][wiki]. - - [wiki]: https://github.com/libgit2/libgit2sharp/wiki - -## Optimizing unit testing -LibGit2Sharp strives to have comprehensive and robust unit test suite to insure the quality of the software and to assist new contributors and users who can use the tests as sample to jump start development. There are over one-thousand unit-tests for LibGit2Sharp, this number will only grow as functionality is added. - -You can do a few things to optimize running unit-tests on Windows: - -1. Set the `LibGit2TestPath` environment variable to a path in your development environment. - * If the unit-test framework cannot find the specified folder at runtime, it will fall back to the default location. -2. Configure your anti-virus software to ignore the `LibGit2TestPath` path. -3. Install a RAM disk like [IMDisk](http://www.ltr-data.se/opencode.html/#ImDisk) and set `LibGit2TestPath` to use it. - * Use `imdisk.exe -a -s 256M -m X: -p "/fs:fat /q /v:ramdisk /y"` to create a RAM disk. This command requires elevated privileges and can be placed into a scheduled task or run manually before you begin unit-testing. - -## Authors - - - **Code:** The LibGit2Sharp [contributors][committers] - - **Logo:** [Jason "blackant" Long][blackant] - - [committers]: https://github.com/libgit2/libgit2sharp/contributors - [blackant]: https://github.com/jasonlong - -## License - -The MIT license (Refer to the [LICENSE.md][license] file) - - [license]: https://github.com/libgit2/libgit2sharp/blob/master/LICENSE.md +Can be used in Unity3d v 5+ for standalone Windows/OSX/Linux