diff options
24 files changed, 109 insertions, 22 deletions
diff --git a/Lib/NativeBinaries/amd64/git2-06d772d.dll b/Lib/NativeBinaries/amd64/git2-06d772d.dll Binary files differdeleted file mode 100644 index 639b55ef..00000000 --- a/Lib/NativeBinaries/amd64/git2-06d772d.dll +++ /dev/null diff --git a/Lib/NativeBinaries/amd64/git2-06d772d.pdb b/Lib/NativeBinaries/amd64/git2-06d772d.pdb Binary files differdeleted file mode 100644 index 589a0487..00000000 --- a/Lib/NativeBinaries/amd64/git2-06d772d.pdb +++ /dev/null diff --git a/Lib/NativeBinaries/amd64/git2-58eea5e.dll b/Lib/NativeBinaries/amd64/git2-58eea5e.dll Binary files differnew file mode 100644 index 00000000..d561f481 --- /dev/null +++ b/Lib/NativeBinaries/amd64/git2-58eea5e.dll diff --git a/Lib/NativeBinaries/amd64/git2-58eea5e.pdb b/Lib/NativeBinaries/amd64/git2-58eea5e.pdb Binary files differnew file mode 100644 index 00000000..ab93e1bf --- /dev/null +++ b/Lib/NativeBinaries/amd64/git2-58eea5e.pdb diff --git a/Lib/NativeBinaries/x86/git2-06d772d.dll b/Lib/NativeBinaries/x86/git2-06d772d.dll Binary files differdeleted file mode 100644 index 1ceb3b2e..00000000 --- a/Lib/NativeBinaries/x86/git2-06d772d.dll +++ /dev/null diff --git a/Lib/NativeBinaries/x86/git2-06d772d.pdb b/Lib/NativeBinaries/x86/git2-06d772d.pdb Binary files differdeleted file mode 100644 index e98d16c5..00000000 --- a/Lib/NativeBinaries/x86/git2-06d772d.pdb +++ /dev/null diff --git a/Lib/NativeBinaries/x86/git2-58eea5e.dll b/Lib/NativeBinaries/x86/git2-58eea5e.dll Binary files differnew file mode 100644 index 00000000..59664a71 --- /dev/null +++ b/Lib/NativeBinaries/x86/git2-58eea5e.dll diff --git a/Lib/NativeBinaries/x86/git2-58eea5e.pdb b/Lib/NativeBinaries/x86/git2-58eea5e.pdb Binary files differnew file mode 100644 index 00000000..4b76374e --- /dev/null +++ b/Lib/NativeBinaries/x86/git2-58eea5e.pdb diff --git a/LibGit2Sharp.Tests/StatusFixture.cs b/LibGit2Sharp.Tests/StatusFixture.cs index b70ff0ae..4a63bc93 100644 --- a/LibGit2Sharp.Tests/StatusFixture.cs +++ b/LibGit2Sharp.Tests/StatusFixture.cs @@ -495,8 +495,12 @@ namespace LibGit2Sharp.Tests Assert.Equal(FileStatus.Ignored, repo.Index.RetrieveStatus("bin/look-ma.txt")); Assert.Equal(FileStatus.Untracked, repo.Index.RetrieveStatus("bin/what-about-me.txt")); + // bin/* is considered as ignoring the dir itself newStatus = repo.Index.RetrieveStatus(); + Assert.Equal(new[] { "bin" + dirSep }, newStatus.Ignored.Select(s => s.FilePath)); + // if we recurse into ignored dirs, then we get the actual list + newStatus = repo.Index.RetrieveStatus(new StatusOptions { RecurseIgnoredDirs = true }); Assert.Equal(new[] { "bin" + dirSep + "look-ma.txt" }, newStatus.Ignored.Select(s => s.FilePath)); Assert.True(newStatus.Untracked.Select(s => s.FilePath).Contains("bin" + dirSep + "what-about-me.txt")); } diff --git a/LibGit2Sharp/BranchCollection.cs b/LibGit2Sharp/BranchCollection.cs index 8075bada..151a0aa2 100644 --- a/LibGit2Sharp/BranchCollection.cs +++ b/LibGit2Sharp/BranchCollection.cs @@ -91,7 +91,7 @@ namespace LibGit2Sharp /// <returns>An <see cref="IEnumerator{T}"/> object that can be used to iterate through the collection.</returns> public virtual IEnumerator<Branch> GetEnumerator() { - return Proxy.git_branch_iterator(repo, GitBranchType.GIT_BRANCH_LOCAL | GitBranchType.GIT_BRANCH_REMOTE) + return Proxy.git_branch_iterator(repo, GitBranchType.GIT_BRANCH_ALL) .ToList().GetEnumerator(); } diff --git a/LibGit2Sharp/Configuration.cs b/LibGit2Sharp/Configuration.cs index 35678d6a..f7044224 100644 --- a/LibGit2Sharp/Configuration.cs +++ b/LibGit2Sharp/Configuration.cs @@ -88,7 +88,8 @@ namespace LibGit2Sharp /// </summary> public virtual bool HasConfig(ConfigurationLevel level) { - using (ConfigurationSafeHandle handle = RetrieveConfigurationHandle(level, false)) + using (ConfigurationSafeHandle snapshot = Snapshot ()) + using (ConfigurationSafeHandle handle = RetrieveConfigurationHandle(level, false, snapshot)) { return handle != null; } @@ -117,7 +118,7 @@ namespace LibGit2Sharp { Ensure.ArgumentNotNullOrEmptyString(key, "key"); - using (ConfigurationSafeHandle h = RetrieveConfigurationHandle(level, true)) + using (ConfigurationSafeHandle h = RetrieveConfigurationHandle(level, true, configHandle)) { Proxy.git_config_delete(h, key); } @@ -164,7 +165,10 @@ namespace LibGit2Sharp { Ensure.ArgumentNotNullOrEmptyString(key, "key"); - return Proxy.git_config_get_entry<T>(configHandle, key); + using (ConfigurationSafeHandle snapshot = Snapshot()) + { + return Proxy.git_config_get_entry<T>(snapshot, key); + } } /// <summary> @@ -192,7 +196,8 @@ namespace LibGit2Sharp { Ensure.ArgumentNotNullOrEmptyString(key, "key"); - using (ConfigurationSafeHandle handle = RetrieveConfigurationHandle(level, false)) + using (ConfigurationSafeHandle snapshot = Snapshot()) + using (ConfigurationSafeHandle handle = RetrieveConfigurationHandle(level, false, snapshot)) { if (handle == null) { @@ -224,7 +229,7 @@ namespace LibGit2Sharp { Ensure.ArgumentNotNullOrEmptyString(key, "key"); - using (ConfigurationSafeHandle h = RetrieveConfigurationHandle(level, true)) + using (ConfigurationSafeHandle h = RetrieveConfigurationHandle(level, true, configHandle)) { if (!configurationTypedUpdater.ContainsKey(typeof(T))) { @@ -246,18 +251,19 @@ namespace LibGit2Sharp { Ensure.ArgumentNotNullOrEmptyString(regexp, "regexp"); - using (ConfigurationSafeHandle h = RetrieveConfigurationHandle(level, true)) + using (ConfigurationSafeHandle snapshot = Snapshot()) + using (ConfigurationSafeHandle h = RetrieveConfigurationHandle(level, true, snapshot)) { return Proxy.git_config_iterator_glob(h, regexp, BuildConfigEntry).ToList(); } } - private ConfigurationSafeHandle RetrieveConfigurationHandle(ConfigurationLevel level, bool throwIfStoreHasNotBeenFound) + private ConfigurationSafeHandle RetrieveConfigurationHandle(ConfigurationLevel level, bool throwIfStoreHasNotBeenFound, ConfigurationSafeHandle fromHandle) { ConfigurationSafeHandle handle = null; - if (configHandle != null) + if (fromHandle != null) { - handle = Proxy.git_config_open_level(configHandle, level); + handle = Proxy.git_config_open_level(fromHandle, level); } if (handle == null && throwIfStoreHasNotBeenFound) @@ -349,5 +355,10 @@ namespace LibGit2Sharp CultureInfo.InvariantCulture, "{0}@{1}", Environment.UserName, Environment.UserDomainName), now); } + + private ConfigurationSafeHandle Snapshot() + { + return Proxy.git_config_snapshot(configHandle); + } } } diff --git a/LibGit2Sharp/Core/GitBranchType.cs b/LibGit2Sharp/Core/GitBranchType.cs index 6304715f..f843c11d 100644 --- a/LibGit2Sharp/Core/GitBranchType.cs +++ b/LibGit2Sharp/Core/GitBranchType.cs @@ -7,5 +7,6 @@ namespace LibGit2Sharp.Core { GIT_BRANCH_LOCAL = 1, GIT_BRANCH_REMOTE = 2, + GIT_BRANCH_ALL = GIT_BRANCH_LOCAL | GIT_BRANCH_REMOTE, } } diff --git a/LibGit2Sharp/Core/GitCloneOptions.cs b/LibGit2Sharp/Core/GitCloneOptions.cs index f3d87cb9..915c56b1 100644 --- a/LibGit2Sharp/Core/GitCloneOptions.cs +++ b/LibGit2Sharp/Core/GitCloneOptions.cs @@ -3,6 +3,14 @@ using System.Runtime.InteropServices; namespace LibGit2Sharp.Core { + internal enum GitCloneLocal + { + CloneLocalAuto, + CloneLocal, + CloneNoLocal, + CloneLocalNoLinks + } + [StructLayout(LayoutKind.Sequential)] internal struct GitCloneOptions { @@ -13,6 +21,7 @@ namespace LibGit2Sharp.Core public int Bare; public int IgnoreCertErrors; + public GitCloneLocal Local; public IntPtr RemoteName; public IntPtr CheckoutBranch; diff --git a/LibGit2Sharp/Core/GitCredentialType.cs b/LibGit2Sharp/Core/GitCredentialType.cs index 7d5abc25..6ae63658 100644 --- a/LibGit2Sharp/Core/GitCredentialType.cs +++ b/LibGit2Sharp/Core/GitCredentialType.cs @@ -27,5 +27,10 @@ namespace LibGit2Sharp.Core /// A key for NTLM/Kerberos "default" credentials. /// </summary> Default = (1 << 3), + + /// <summary> + /// TODO + /// </summary> + SshInteractive = (1 << 4), } } diff --git a/LibGit2Sharp/Core/GitDiff.cs b/LibGit2Sharp/Core/GitDiff.cs index 89f07e61..4ef6a251 100644 --- a/LibGit2Sharp/Core/GitDiff.cs +++ b/LibGit2Sharp/Core/GitDiff.cs @@ -104,6 +104,14 @@ namespace LibGit2Sharp.Core /// </summary> GIT_DIFF_ENABLE_FAST_UNTRACKED_DIRS = (1 << 14), + /// <summary> + /// When diff finds a file in the working directory with stat + /// information different from the index, but the OID ends up being the + /// same, write the correct stat information into the index. Note: + /// without this flag, diff will always leave the index untouched. + /// </summary> + GIT_DIFF_UPDATE_INDEX = (1 << 15), + /* * Options controlling how output will be generated */ @@ -158,6 +166,12 @@ namespace LibGit2Sharp.Core /// Take extra time to find minimal diff /// </summary> GIT_DIFF_MINIMAL = (1 << 29), + + /// <summary> + /// Include the necessary deflate / delta information so that `git-apply` + /// can apply given diff information to binary files. + /// </summary> + GIT_DIFF_SHOW_BINARY = (1 << 30), } internal delegate int diff_notify_cb( diff --git a/LibGit2Sharp/Core/GitMergeOpts.cs b/LibGit2Sharp/Core/GitMergeOpts.cs index 0c677817..a2ebe979 100644 --- a/LibGit2Sharp/Core/GitMergeOpts.cs +++ b/LibGit2Sharp/Core/GitMergeOpts.cs @@ -71,6 +71,27 @@ namespace LibGit2Sharp.Core GIT_MERGE_ANALYSIS_UNBORN = (1 << 3), } + internal enum GitMergePreference + { + /// <summary> + /// No configuration was found that suggests a preferred behavior for + /// merge. + /// </summary> + GIT_MERGE_PREFERENCE_NONE = 0, + + /// <summary> + /// There is a `merge.ff=false` configuration setting, suggesting that + /// the user does not want to allow a fast-forward merge. + /// </summary> + GIT_MERGE_PREFERENCE_NO_FASTFORWARD = (1 << 0), + + /// <summary> + /// There is a `merge.ff=only` configuration setting, suggesting that + /// the user only wants fast-forward merges. + /// </summary> + GIT_MERGE_PREFERENCE_FASTFORWARD_ONLY = (1 << 1), + } + [Flags] internal enum GitMergeTreeFlags { diff --git a/LibGit2Sharp/Core/GitRemoteHead.cs b/LibGit2Sharp/Core/GitRemoteHead.cs index 2c6bce91..02c2def8 100644 --- a/LibGit2Sharp/Core/GitRemoteHead.cs +++ b/LibGit2Sharp/Core/GitRemoteHead.cs @@ -10,5 +10,6 @@ namespace LibGit2Sharp.Core public GitOid Oid; public GitOid Loid; public IntPtr NamePtr; + public IntPtr SymRefTargetPtr; } } diff --git a/LibGit2Sharp/Core/GitStatusOptions.cs b/LibGit2Sharp/Core/GitStatusOptions.cs index 5d02ebfe..ce850410 100644 --- a/LibGit2Sharp/Core/GitStatusOptions.cs +++ b/LibGit2Sharp/Core/GitStatusOptions.cs @@ -49,5 +49,7 @@ namespace LibGit2Sharp.Core SortCaseSensitively = (1 << 9), SortCaseInsensitively = (1 << 10), RenamesFromRewrites = (1 << 11), + NoRefresh = (1 << 12), + UpdateIndex = (1 << 13), } } diff --git a/LibGit2Sharp/Core/NativeDllName.cs b/LibGit2Sharp/Core/NativeDllName.cs index 76e36168..3f1f7cfd 100644 --- a/LibGit2Sharp/Core/NativeDllName.cs +++ b/LibGit2Sharp/Core/NativeDllName.cs @@ -2,6 +2,6 @@ namespace LibGit2Sharp.Core { internal static class NativeDllName { - public const string Name = "git2-06d772d"; + public const string Name = "git2-58eea5e"; } } diff --git a/LibGit2Sharp/Core/NativeMethods.cs b/LibGit2Sharp/Core/NativeMethods.cs index 94175a94..740de10d 100644 --- a/LibGit2Sharp/Core/NativeMethods.cs +++ b/LibGit2Sharp/Core/NativeMethods.cs @@ -380,6 +380,9 @@ namespace LibGit2Sharp.Core [DllImport(libgit2)] internal static extern void git_config_iterator_free(IntPtr iter); + [DllImport(libgit2)] + internal static extern int git_config_snapshot(out ConfigurationSafeHandle @out, ConfigurationSafeHandle config); + // Ordinarily we would decorate the `url` parameter with the StrictUtf8Marshaler like we do everywhere // else, but apparently doing a native->managed callback with the 64-bit version of CLR 2.0 can // sometimes vomit when using a custom IMarshaler. So yeah, don't do that. If you need the url, @@ -621,6 +624,7 @@ namespace LibGit2Sharp.Core [DllImport(libgit2)] internal static extern int git_merge_analysis( out GitMergeAnalysis status_out, + out GitMergePreference preference_out, RepositorySafeHandle repo, [In] IntPtr[] their_heads, int their_heads_len); @@ -633,7 +637,8 @@ namespace LibGit2Sharp.Core internal static extern int git_message_prettify( GitBuf buf, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(StrictUtf8Marshaler))] string message, - [MarshalAs(UnmanagedType.Bool)] bool strip_comments); + [MarshalAs(UnmanagedType.Bool)] bool strip_comments, + sbyte comment_char); [DllImport(libgit2)] internal static extern int git_note_create( diff --git a/LibGit2Sharp/Core/Proxy.cs b/LibGit2Sharp/Core/Proxy.cs index 997dcd23..2da9a5dc 100644 --- a/LibGit2Sharp/Core/Proxy.cs +++ b/LibGit2Sharp/Core/Proxy.cs @@ -569,6 +569,18 @@ namespace LibGit2Sharp.Core NativeMethods.git_config_iterator_free(iter); } + public static ConfigurationSafeHandle git_config_snapshot(ConfigurationSafeHandle config) + { + using (ThreadAffinity()) + { + ConfigurationSafeHandle handle; + int res = NativeMethods.git_config_snapshot(out handle, config); + Ensure.ZeroResult(res); + + return handle; + } + } + #endregion #region git_diff_ @@ -1022,25 +1034,24 @@ namespace LibGit2Sharp.Core } } - public static GitMergeAnalysis git_merge_analysis( + public static void git_merge_analysis( RepositorySafeHandle repo, - GitMergeHeadHandle[] heads) + GitMergeHeadHandle[] heads, + out GitMergeAnalysis analysis_out, + out GitMergePreference preference_out) { using (ThreadAffinity()) { - GitMergeAnalysis ret; - IntPtr[] their_heads = heads.Select(head => head.DangerousGetHandle()).ToArray(); int res = NativeMethods.git_merge_analysis( - out ret, + out analysis_out, + out preference_out, repo, their_heads, their_heads.Length); Ensure.ZeroResult(res); - - return ret; } } @@ -1063,7 +1074,7 @@ namespace LibGit2Sharp.Core using (ThreadAffinity()) using (var buf = new GitBuf()) { - int res= NativeMethods.git_message_prettify(buf, message, false); + int res= NativeMethods.git_message_prettify(buf, message, false, (sbyte)'#'); Ensure.Int32Result(res); return LaxUtf8Marshaler.FromNative(buf.ptr) ?? string.Empty; diff --git a/LibGit2Sharp/Repository.cs b/LibGit2Sharp/Repository.cs index a127f6ab..91231a76 100644 --- a/LibGit2Sharp/Repository.cs +++ b/LibGit2Sharp/Repository.cs @@ -1251,7 +1251,10 @@ namespace LibGit2Sharp /// <returns>The <see cref="MergeResult"/> of the merge.</returns> private MergeResult Merge(GitMergeHeadHandle[] mergeHeads, Signature merger, MergeOptions options) { - GitMergeAnalysis mergeAnalysis = Proxy.git_merge_analysis(Handle, mergeHeads); + GitMergeAnalysis mergeAnalysis; + GitMergePreference mergePreference; + + Proxy.git_merge_analysis(Handle, mergeHeads, out mergeAnalysis, out mergePreference); MergeResult mergeResult = null; diff --git a/LibGit2Sharp/libgit2_hash.txt b/LibGit2Sharp/libgit2_hash.txt index 17a851d8..8ecd9c25 100644 --- a/LibGit2Sharp/libgit2_hash.txt +++ b/LibGit2Sharp/libgit2_hash.txt @@ -1 +1 @@ -06d772d8d45e3e2830614a62a51910547afb6666 +58eea5ebf40b698cbaf028b23ee6157d5eb6582c diff --git a/libgit2 b/libgit2 -Subproject 06d772d8d45e3e2830614a62a51910547afb666 +Subproject 58eea5ebf40b698cbaf028b23ee6157d5eb6582 |