diff --git a/CHANGES.md b/CHANGES.md index 3281881d5..3669bd560 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -8,6 +8,18 @@ - CI server: - @libgit2sharp: +## v0.14.1 - ([diff](https://github.com/libgit2/libgit2sharp/compare/v0.14.0...v0.14.1)) + +### Changes + + - Rename OrphanedHeadException into UnbornBranchException + +### Fixes + + - Fix handling of http->https redirects + - Make probing for libgit2 binaries work from within the NuGet packages folder + - Accept submodule paths with native directory separators + ## v0.14.0 - ([diff](https://github.com/libgit2/libgit2sharp/compare/v0.13.0...v0.14.0)) ### Additions diff --git a/Lib/NativeBinaries/amd64/git2-11f8336.dll b/Lib/NativeBinaries/amd64/git2-11f8336.dll new file mode 100644 index 000000000..d06ebea12 Binary files /dev/null and b/Lib/NativeBinaries/amd64/git2-11f8336.dll differ diff --git a/Lib/NativeBinaries/amd64/git2-32e4992.pdb b/Lib/NativeBinaries/amd64/git2-11f8336.pdb similarity index 54% rename from Lib/NativeBinaries/amd64/git2-32e4992.pdb rename to Lib/NativeBinaries/amd64/git2-11f8336.pdb index 951dfddcb..34989493f 100644 Binary files a/Lib/NativeBinaries/amd64/git2-32e4992.pdb and b/Lib/NativeBinaries/amd64/git2-11f8336.pdb differ diff --git a/Lib/NativeBinaries/amd64/git2-32e4992.dll b/Lib/NativeBinaries/amd64/git2-32e4992.dll deleted file mode 100644 index e60a2d705..000000000 Binary files a/Lib/NativeBinaries/amd64/git2-32e4992.dll and /dev/null differ diff --git a/Lib/NativeBinaries/x86/git2-11f8336.dll b/Lib/NativeBinaries/x86/git2-11f8336.dll new file mode 100644 index 000000000..7d66ec112 Binary files /dev/null and b/Lib/NativeBinaries/x86/git2-11f8336.dll differ diff --git a/Lib/NativeBinaries/x86/git2-32e4992.pdb b/Lib/NativeBinaries/x86/git2-11f8336.pdb similarity index 51% rename from Lib/NativeBinaries/x86/git2-32e4992.pdb rename to Lib/NativeBinaries/x86/git2-11f8336.pdb index 48ab4a087..def46eba0 100644 Binary files a/Lib/NativeBinaries/x86/git2-32e4992.pdb and b/Lib/NativeBinaries/x86/git2-11f8336.pdb differ diff --git a/Lib/NativeBinaries/x86/git2-32e4992.dll b/Lib/NativeBinaries/x86/git2-32e4992.dll deleted file mode 100644 index aef5e5934..000000000 Binary files a/Lib/NativeBinaries/x86/git2-32e4992.dll and /dev/null differ diff --git a/LibGit2Sharp.Tests/CheckoutFixture.cs b/LibGit2Sharp.Tests/CheckoutFixture.cs index 27e8a240c..9db8d36f8 100644 --- a/LibGit2Sharp.Tests/CheckoutFixture.cs +++ b/LibGit2Sharp.Tests/CheckoutFixture.cs @@ -361,9 +361,9 @@ public void CheckingOutAgainstAnUnbornBranchThrows() using (var repo = new Repository(repoPath)) { - Assert.True(repo.Info.IsHeadOrphaned); + Assert.True(repo.Info.IsHeadUnborn); - Assert.Throws(() => repo.Checkout(repo.Head)); + Assert.Throws(() => repo.Checkout(repo.Head)); } } diff --git a/LibGit2Sharp.Tests/CommitFixture.cs b/LibGit2Sharp.Tests/CommitFixture.cs index a465ae36b..66c89a895 100644 --- a/LibGit2Sharp.Tests/CommitFixture.cs +++ b/LibGit2Sharp.Tests/CommitFixture.cs @@ -640,7 +640,7 @@ public void CanCommitALittleBit() AssertBlobContent(commit[relativeFilepath], "nulltoken\n"); Assert.Equal(0, commit.Parents.Count()); - Assert.False(repo.Info.IsHeadOrphaned); + Assert.False(repo.Info.IsHeadUnborn); // Assert a reflog entry is created on HEAD Assert.Equal(1, repo.Refs.Log("HEAD").Count()); @@ -804,7 +804,7 @@ public void CanNotAmendAnEmptyRepository() using (var repo = new Repository(repoPath)) { - Assert.Throws(() => repo.Commit("I can not amend anything !:(", Constants.Signature, Constants.Signature, true)); + Assert.Throws(() => repo.Commit("I can not amend anything !:(", Constants.Signature, Constants.Signature, true)); } } diff --git a/LibGit2Sharp.Tests/RepositoryFixture.cs b/LibGit2Sharp.Tests/RepositoryFixture.cs index a0640aa5f..01fa8e76a 100644 --- a/LibGit2Sharp.Tests/RepositoryFixture.cs +++ b/LibGit2Sharp.Tests/RepositoryFixture.cs @@ -228,7 +228,7 @@ private static void AssertInitializedRepository(Repository repo, string expected { Assert.NotNull(repo.Info.Path); Assert.False(repo.Info.IsHeadDetached); - Assert.True(repo.Info.IsHeadOrphaned); + Assert.True(repo.Info.IsHeadUnborn); Reference headRef = repo.Refs.Head; Assert.NotNull(headRef); @@ -541,13 +541,13 @@ public void CanDetectIfTheHeadIsOrphaned() { string branchName = repo.Head.CanonicalName; - Assert.False(repo.Info.IsHeadOrphaned); + Assert.False(repo.Info.IsHeadUnborn); repo.Refs.Add("HEAD", "refs/heads/orphan", true); - Assert.True(repo.Info.IsHeadOrphaned); + Assert.True(repo.Info.IsHeadUnborn); repo.Refs.Add("HEAD", branchName, true); - Assert.False(repo.Info.IsHeadOrphaned); + Assert.False(repo.Info.IsHeadUnborn); } } diff --git a/LibGit2Sharp.Tests/SubmoduleFixture.cs b/LibGit2Sharp.Tests/SubmoduleFixture.cs index e427e624d..e1b378b71 100644 --- a/LibGit2Sharp.Tests/SubmoduleFixture.cs +++ b/LibGit2Sharp.Tests/SubmoduleFixture.cs @@ -1,4 +1,5 @@ using System; +using System.IO; using System.Linq; using LibGit2Sharp.Tests.TestHelpers; using Xunit; @@ -103,14 +104,17 @@ public void CanEnumerateRepositorySubmodules() } [Theory] - [InlineData("sm_changed_head")] - [InlineData("sm_changed_head/")] - public void CanStageChangeInSubmoduleViaIndexStage(string submodulePath) + [InlineData("sm_changed_head", false)] + [InlineData("sm_changed_head", true)] + public void CanStageChangeInSubmoduleViaIndexStage(string submodulePath, bool appendPathSeparator) { + submodulePath += appendPathSeparator ? Path.DirectorySeparatorChar : default(char?); + var path = CloneSubmoduleTestRepo(); using (var repo = new Repository(path)) { var submodule = repo.Submodules[submodulePath]; + Assert.NotNull(submodule); var statusBefore = submodule.RetrieveStatus(); Assert.Equal(SubmoduleStatus.WorkDirModified, statusBefore & SubmoduleStatus.WorkDirModified); @@ -123,21 +127,24 @@ public void CanStageChangeInSubmoduleViaIndexStage(string submodulePath) } [Theory] - [InlineData("sm_changed_head")] - [InlineData("sm_changed_head/")] - public void CanStageChangeInSubmoduleViaIndexStageWithOtherPaths(string submodulePath) + [InlineData("sm_changed_head", false)] + [InlineData("sm_changed_head", true)] + public void CanStageChangeInSubmoduleViaIndexStageWithOtherPaths(string submodulePath, bool appendPathSeparator) { + submodulePath += appendPathSeparator ? Path.DirectorySeparatorChar : default(char?); + var path = CloneSubmoduleTestRepo(); using (var repo = new Repository(path)) { var submodule = repo.Submodules[submodulePath]; + Assert.NotNull(submodule); var statusBefore = submodule.RetrieveStatus(); Assert.Equal(SubmoduleStatus.WorkDirModified, statusBefore & SubmoduleStatus.WorkDirModified); Touch(repo.Info.WorkingDirectory, "new-file.txt"); - repo.Index.Stage(new[]{ "new-file.txt", submodulePath, "does-not-exist.txt" }); + repo.Index.Stage(new[] { "new-file.txt", submodulePath, "does-not-exist.txt" }); var statusAfter = submodule.RetrieveStatus(); Assert.Equal(SubmoduleStatus.IndexModified, statusAfter & SubmoduleStatus.IndexModified); diff --git a/LibGit2Sharp.Tests/TagFixture.cs b/LibGit2Sharp.Tests/TagFixture.cs index a7b8524ac..7d5751ad1 100644 --- a/LibGit2Sharp.Tests/TagFixture.cs +++ b/LibGit2Sharp.Tests/TagFixture.cs @@ -602,7 +602,7 @@ public void CanListAllTagsInAEmptyRepository() using (var repo = new Repository(repoPath)) { - Assert.True(repo.Info.IsHeadOrphaned); + Assert.True(repo.Info.IsHeadUnborn); Assert.Equal(0, repo.Tags.Count()); } } diff --git a/LibGit2Sharp.Tests/UnstageFixture.cs b/LibGit2Sharp.Tests/UnstageFixture.cs index 856a8e4fa..fea1aea3b 100644 --- a/LibGit2Sharp.Tests/UnstageFixture.cs +++ b/LibGit2Sharp.Tests/UnstageFixture.cs @@ -162,7 +162,7 @@ public void UnstagingUnknownPathsAgainstAnOrphanedHeadWithStrictUnmatchedExplici using (var repo = new Repository(CloneStandardTestRepo())) { repo.Refs.UpdateTarget("HEAD", "refs/heads/orphaned"); - Assert.True(repo.Info.IsHeadOrphaned); + Assert.True(repo.Info.IsHeadUnborn); Assert.Equal(currentStatus, repo.Index.RetrieveStatus(relativePath)); @@ -178,7 +178,7 @@ public void CanUnstageUnknownPathsAgainstAnOrphanedHeadWithLaxUnmatchedExplicitP using (var repo = new Repository(CloneStandardTestRepo())) { repo.Refs.UpdateTarget("HEAD", "refs/heads/orphaned"); - Assert.True(repo.Info.IsHeadOrphaned); + Assert.True(repo.Info.IsHeadUnborn); Assert.Equal(currentStatus, repo.Index.RetrieveStatus(relativePath)); diff --git a/LibGit2Sharp/BlobExtensions.cs b/LibGit2Sharp/BlobExtensions.cs index 4d673ff0a..a00208ec6 100644 --- a/LibGit2Sharp/BlobExtensions.cs +++ b/LibGit2Sharp/BlobExtensions.cs @@ -27,31 +27,5 @@ public static string ContentAsText(this Blob blob, Encoding encoding = null) return reader.ReadToEnd(); } } - - /// - /// Gets the blob content decoded as UTF-8. - /// - /// The blob for which the content will be returned. - /// Blob content as UTF-8 - [Obsolete("This method will be removed in the next release. Please use ContentAsText()")] - public static string ContentAsUtf8(this Blob blob) - { - Ensure.ArgumentNotNull(blob, "blob"); - - return blob.ContentAsText(Encoding.UTF8); - } - - /// - /// Gets the blob content decoded as Unicode. - /// - /// The blob for which the content will be returned. - /// Blob content as unicode. - [Obsolete("This method will be removed in the next release. Please use ContentAsText()")] - public static string ContentAsUnicode(this Blob blob) - { - Ensure.ArgumentNotNull(blob, "blob"); - - return blob.ContentAsText(Encoding.Unicode); - } } } diff --git a/LibGit2Sharp/BranchTrackingDetails.cs b/LibGit2Sharp/BranchTrackingDetails.cs index 0f2fac1d9..0acce526e 100644 --- a/LibGit2Sharp/BranchTrackingDetails.cs +++ b/LibGit2Sharp/BranchTrackingDetails.cs @@ -31,7 +31,8 @@ internal BranchTrackingDetails(Repository repo, Branch branch) /// /// Gets the number of commits that exist in this local branch but don't exist in the tracked one. /// - /// This property will return null if there is no tracked branch linked to this local branch. + /// This property will return null if this local branch has no upstream configuration + /// or if the upstream branch does not exist /// /// public virtual int? AheadBy @@ -42,7 +43,8 @@ public virtual int? AheadBy /// /// Gets the number of commits that exist in the tracked branch but don't exist in this local one. /// - /// This property will return null if there is no tracked branch linked to this local branch. + /// This property will return null if this local branch has no upstream configuration + /// or if the upstream branch does not exist /// /// public virtual int? BehindBy @@ -53,8 +55,8 @@ public virtual int? BehindBy /// /// Gets the common ancestor of the local branch and its tracked remote branch. /// - /// This property will return null if there is no tracked branch linked to this local branch, - /// or if either branch is an orphan. + /// This property will return null if this local branch has no upstream configuration, + /// the upstream branch does not exist, or either branch is an orphan. /// /// public virtual Commit CommonAncestor diff --git a/LibGit2Sharp/Core/GitCloneOptions.cs b/LibGit2Sharp/Core/GitCloneOptions.cs index 4b6c68322..5382b60a2 100644 --- a/LibGit2Sharp/Core/GitCloneOptions.cs +++ b/LibGit2Sharp/Core/GitCloneOptions.cs @@ -9,6 +9,7 @@ internal class GitCloneOptions public uint Version = 1; public GitCheckoutOpts CheckoutOpts; + public IntPtr InitOptions; public int Bare; public NativeMethods.git_transfer_progress_callback TransferProgressCallback; public IntPtr TransferProgressPayload; diff --git a/LibGit2Sharp/Core/GitErrorCategory.cs b/LibGit2Sharp/Core/GitErrorCategory.cs index d8d06676f..6782871cb 100644 --- a/LibGit2Sharp/Core/GitErrorCategory.cs +++ b/LibGit2Sharp/Core/GitErrorCategory.cs @@ -23,5 +23,9 @@ internal enum GitErrorCategory Thread, Stash, Checkout, + FetchHead, + Merge, + Ssh, + Filter, } } diff --git a/LibGit2Sharp/Core/GitOdbBackendStream.cs b/LibGit2Sharp/Core/GitOdbBackendStream.cs index 5c5dbd18b..82f6ce89c 100644 --- a/LibGit2Sharp/Core/GitOdbBackendStream.cs +++ b/LibGit2Sharp/Core/GitOdbBackendStream.cs @@ -22,6 +22,9 @@ static GitOdbBackendStream() public GitOdbBackendStreamMode Mode; public IntPtr HashCtx; + public UIntPtr DeclaredSize; + public UIntPtr ReceivedBytes; + public read_callback Read; public write_callback Write; public finalize_write_callback FinalizeWrite; diff --git a/LibGit2Sharp/Core/NativeDllName.cs b/LibGit2Sharp/Core/NativeDllName.cs index 7f4d6c955..03663892b 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-32e4992"; + public const string Name = "git2-11f8336"; } } diff --git a/LibGit2Sharp/Core/NativeMethods.cs b/LibGit2Sharp/Core/NativeMethods.cs index e36fade8b..9fc8ba878 100644 --- a/LibGit2Sharp/Core/NativeMethods.cs +++ b/LibGit2Sharp/Core/NativeMethods.cs @@ -879,7 +879,7 @@ internal static extern int git_repository_fetchhead_foreach( internal static extern int git_repository_head_detached(RepositorySafeHandle repo); [DllImport(libgit2)] - internal static extern int git_repository_head_orphan(RepositorySafeHandle repo); + internal static extern int git_repository_head_unborn(RepositorySafeHandle repo); [DllImport(libgit2)] internal static extern int git_repository_index(out IndexSafeHandle index, RepositorySafeHandle repo); @@ -1047,7 +1047,7 @@ internal delegate int git_status_cb( internal static extern int git_submodule_lookup( out SubmoduleSafeHandle reference, RepositorySafeHandle repo, - [MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(Utf8Marshaler))] string name); + [MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(FilePathMarshaler))] FilePath name); internal delegate int submodule_callback( IntPtr sm, diff --git a/LibGit2Sharp/Core/Proxy.cs b/LibGit2Sharp/Core/Proxy.cs index 3e45c6cd0..cf9dfe2b3 100644 --- a/LibGit2Sharp/Core/Proxy.cs +++ b/LibGit2Sharp/Core/Proxy.cs @@ -1556,9 +1556,9 @@ public static void git_repository_free(IntPtr repo) NativeMethods.git_repository_free(repo); } - public static bool git_repository_head_orphan(RepositorySafeHandle repo) + public static bool git_repository_head_unborn(RepositorySafeHandle repo) { - return RepositoryStateChecker(repo, NativeMethods.git_repository_head_orphan); + return RepositoryStateChecker(repo, NativeMethods.git_repository_head_unborn); } public static IndexSafeHandle git_repository_index(RepositorySafeHandle repo) @@ -1978,7 +1978,7 @@ public static ICollection git_status_foreach(RepositorySafeHan /// Returns a handle to the corresponding submodule, /// or an invalid handle if a submodule is not found. /// - public static SubmoduleSafeHandle git_submodule_lookup(RepositorySafeHandle repo, string name) + public static SubmoduleSafeHandle git_submodule_lookup(RepositorySafeHandle repo, FilePath name) { using (ThreadAffinity()) { diff --git a/LibGit2Sharp/IRepository.cs b/LibGit2Sharp/IRepository.cs index cb617a135..763b7bbfc 100644 --- a/LibGit2Sharp/IRepository.cs +++ b/LibGit2Sharp/IRepository.cs @@ -111,20 +111,6 @@ public interface IRepository : IDisposable /// The that was checked out. Branch Checkout(Commit commit, CheckoutModifiers checkoutModifiers, CheckoutProgressHandler onCheckoutProgress, CheckoutNotificationOptions checkoutNotificationOptions); - /// - /// Checkout files from the specified branch, reference or SHA. - /// - /// This method does not switch branches or update the current repository HEAD. - /// - /// - /// A revparse spec for the commit or branch to checkout paths from. - /// The paths to checkout. - /// Options controlling checkout behavior. - /// Callback method to report checkout progress updates through. - /// to manage checkout notifications. - [Obsolete("This method will be removed in the next release. Please use CheckoutPaths(string, IEnumerable, CheckoutOptions) instead.")] - void CheckoutPaths(string committishOrBranchSpec, IList paths, CheckoutModifiers checkoutOptions, CheckoutProgressHandler onCheckoutProgress, CheckoutNotificationOptions checkoutNotificationOptions); - /// /// Updates specifed paths in the index and working directory with the versions from the specified branch, reference, or SHA. /// diff --git a/LibGit2Sharp/Index.cs b/LibGit2Sharp/Index.cs index f5b128702..d077f0e7f 100644 --- a/LibGit2Sharp/Index.cs +++ b/LibGit2Sharp/Index.cs @@ -212,7 +212,7 @@ public virtual void Unstage(IEnumerable paths, ExplicitPathsOptions expl { Ensure.ArgumentNotNull(paths, "paths"); - if (repo.Info.IsHeadOrphaned) + if (repo.Info.IsHeadUnborn) { var compareOptions = new CompareOptions { SkipPatchBuilding = true }; TreeChanges changes = repo.Diff.Compare(null, DiffTargets.Index, paths, explicitPathsOptions, compareOptions); diff --git a/LibGit2Sharp/LibGit2Sharp.csproj b/LibGit2Sharp/LibGit2Sharp.csproj index 18810b4c3..1ff1ce6fa 100644 --- a/LibGit2Sharp/LibGit2Sharp.csproj +++ b/LibGit2Sharp/LibGit2Sharp.csproj @@ -72,6 +72,7 @@ + diff --git a/LibGit2Sharp/OrphanedHeadException.cs b/LibGit2Sharp/OrphanedHeadException.cs index aa5398bb6..a314d6df7 100644 --- a/LibGit2Sharp/OrphanedHeadException.cs +++ b/LibGit2Sharp/OrphanedHeadException.cs @@ -8,7 +8,8 @@ namespace LibGit2Sharp /// branch is performed against an unborn branch. /// [Serializable] - public class OrphanedHeadException : LibGit2SharpException + [Obsolete("This type will be removed in the next release. Please use UnbornBranchException instead.")] + public class OrphanedHeadException : UnbornBranchException { /// /// Initializes a new instance of the class. diff --git a/LibGit2Sharp/Properties/AssemblyInfo.cs b/LibGit2Sharp/Properties/AssemblyInfo.cs index 4d526f19d..1e2626b5d 100644 --- a/LibGit2Sharp/Properties/AssemblyInfo.cs +++ b/LibGit2Sharp/Properties/AssemblyInfo.cs @@ -42,5 +42,5 @@ // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("0.14.0")] -[assembly: AssemblyFileVersion("0.14.0")] +[assembly: AssemblyVersion("0.14.1")] +[assembly: AssemblyFileVersion("0.14.1")] diff --git a/LibGit2Sharp/ReferenceCollection.cs b/LibGit2Sharp/ReferenceCollection.cs index 8103d2357..edd041a5a 100644 --- a/LibGit2Sharp/ReferenceCollection.cs +++ b/LibGit2Sharp/ReferenceCollection.cs @@ -334,38 +334,6 @@ public virtual ReflogCollection Log(Reference reference) return new ReflogCollection(repo, reference.CanonicalName); } - /// - /// Rewrite some of the commits in the repository and all the references that can reach them. - /// - /// The objects to rewrite. - /// Visitor for rewriting commit metadata. - /// Visitor for rewriting commit trees. - /// Visitor for renaming tags. This is called with (OldTag.Name, OldTag.IsAnnotated, OldTarget). - /// Visitor for mangling parent links. - /// Namespace where to store the rewritten references (defaults to "refs/original/") - [Obsolete("This method will be removed in the next release. Please use overload with RewriteHistoryOptions.")] - public virtual void RewriteHistory( - IEnumerable commitsToRewrite, - Func commitHeaderRewriter = null, - Func commitTreeRewriter = null, - Func tagNameRewriter = null, - Func, IEnumerable> commitParentsRewriter = null, - string backupRefsNamespace = "refs/original/") - { - RewriteHistory(new RewriteHistoryOptions - { - BackupRefsNamespace = backupRefsNamespace, - CommitHeaderRewriter = commitHeaderRewriter, - CommitParentsRewriter = commitParentsRewriter == null - ? default(Func>) - : (c => commitParentsRewriter(c.Parents)), - CommitTreeRewriter = commitTreeRewriter, - TagNameRewriter = tagNameRewriter == null - ? default(Func) - : (n, a, t) => tagNameRewriter(n, a, repo.Lookup(t)), - }, commitsToRewrite); - } - /// /// Rewrite some of the commits in the repository and all the references that can reach them. /// diff --git a/LibGit2Sharp/Repository.cs b/LibGit2Sharp/Repository.cs index d860e23b5..d9399302b 100644 --- a/LibGit2Sharp/Repository.cs +++ b/LibGit2Sharp/Repository.cs @@ -665,7 +665,7 @@ public Branch Checkout(Branch branch, CheckoutModifiers checkoutModifiers, Check // Make sure this is not an unborn branch. if (branch.Tip == null) { - throw new OrphanedHeadException( + throw new UnbornBranchException( string.Format(CultureInfo.InvariantCulture, "The tip of branch '{0}' is null. There's nothing to checkout.", branch.Name)); } @@ -807,30 +807,6 @@ public void Reset(ResetOptions resetOptions, Commit commit) Refs.Log(Refs.Head).Append(commit.Id, string.Format("reset: moving to {0}", commit.Sha)); } - /// - /// Updates specifed paths in the index and working directory with the versions from the specified branch, reference, or SHA. - /// - /// This method does not switch branches or update the current repository HEAD. - /// - /// - /// A revparse spec for the commit or branch to checkout paths from. - /// The paths to checkout. - /// Options controlling checkout behavior. - /// Callback method to report checkout progress updates through. - /// to manage checkout notifications. - [Obsolete("This method will be removed in the next release. Please use CheckoutPaths(string, IEnumerable, CheckoutOptions) instead.")] - public void CheckoutPaths(string committishOrBranchSpec, IList paths, CheckoutModifiers checkoutOptions, CheckoutProgressHandler onCheckoutProgress, CheckoutNotificationOptions checkoutNotificationOptions) - { - var opts = new CheckoutOptions - { - CheckoutModifiers = checkoutOptions, - OnCheckoutProgress = onCheckoutProgress, - CheckoutNotificationOptions = checkoutNotificationOptions - }; - - CheckoutPaths(committishOrBranchSpec, paths, opts); - } - /// /// Updates specifed paths in the index and working directory with the versions from the specified branch, reference, or SHA. /// @@ -889,11 +865,11 @@ public void Reset(Commit commit, IEnumerable paths = null, ExplicitPaths /// The generated . public Commit Commit(string message, Signature author, Signature committer, bool amendPreviousCommit = false) { - bool isHeadOrphaned = Info.IsHeadOrphaned; + bool isHeadOrphaned = Info.IsHeadUnborn; if (amendPreviousCommit && isHeadOrphaned) { - throw new OrphanedHeadException("Can not amend anything. The Head doesn't point at any commit."); + throw new UnbornBranchException("Can not amend anything. The Head doesn't point at any commit."); } var treeId = Proxy.git_tree_create_fromindex(Index); @@ -949,7 +925,7 @@ private IEnumerable RetrieveParentsOfTheCommitBeingCreated(bool amendPre return Head.Tip.Parents; } - if (Info.IsHeadOrphaned) + if (Info.IsHeadUnborn) { return Enumerable.Empty(); } diff --git a/LibGit2Sharp/RepositoryInformation.cs b/LibGit2Sharp/RepositoryInformation.cs index 5eddc34ad..3fd789221 100644 --- a/LibGit2Sharp/RepositoryInformation.cs +++ b/LibGit2Sharp/RepositoryInformation.cs @@ -1,4 +1,5 @@ -using LibGit2Sharp.Core; +using System; +using LibGit2Sharp.Core; namespace LibGit2Sharp { @@ -62,9 +63,19 @@ public virtual bool IsHeadDetached /// /// Indicates whether the Head points to a reference which doesn't exist. /// + [Obsolete("This property will be removed in the next release. Please use IsHeadUnborn instead.")] public virtual bool IsHeadOrphaned { - get { return Proxy.git_repository_head_orphan(repo.Handle); } + get { return IsHeadUnborn; } + } + + + /// + /// Indicates whether the Head points to a reference which doesn't exist. + /// + public virtual bool IsHeadUnborn + { + get { return Proxy.git_repository_head_unborn(repo.Handle); } } /// diff --git a/LibGit2Sharp/UnbornBranchException.cs b/LibGit2Sharp/UnbornBranchException.cs new file mode 100644 index 000000000..0ee5e4afa --- /dev/null +++ b/LibGit2Sharp/UnbornBranchException.cs @@ -0,0 +1,49 @@ +using System; +using System.Runtime.Serialization; + +namespace LibGit2Sharp +{ + /// + /// The exception that is thrown when a operation requiring an existing + /// branch is performed against an unborn branch. + /// + [Serializable] + public class UnbornBranchException : LibGit2SharpException + { + /// + /// Initializes a new instance of the class. + /// + public UnbornBranchException() + { + } + + /// + /// Initializes a new instance of the class with a specified error message. + /// + /// A message that describes the error. + public UnbornBranchException(string message) + : base(message) + { + } + + /// + /// Initializes a new instance of the class with a specified error message and a reference to the inner exception that is the cause of this exception. + /// + /// The error message that explains the reason for the exception. + /// The exception that is the cause of the current exception. If the parameter is not a null reference, the current exception is raised in a catch block that handles the inner exception. + public UnbornBranchException(string message, Exception innerException) + : base(message, innerException) + { + } + + /// + /// Initializes a new instance of the class with a serialized data. + /// + /// The that holds the serialized object data about the exception being thrown. + /// The that contains contextual information about the source or destination. + protected UnbornBranchException(SerializationInfo info, StreamingContext context) + : base(info, context) + { + } + } +} diff --git a/LibGit2Sharp/libgit2_hash.txt b/LibGit2Sharp/libgit2_hash.txt index 5a9529f07..f3f5d3a01 100644 --- a/LibGit2Sharp/libgit2_hash.txt +++ b/LibGit2Sharp/libgit2_hash.txt @@ -1 +1 @@ -32e49929725a76d9871038f30e2ea67fe0e4a4f8 +11f8336ec93ea3a270c9fe80c4bbb68aa4729423 diff --git a/libgit2 b/libgit2 index 32e499297..11f8336ec 160000 --- a/libgit2 +++ b/libgit2 @@ -1 +1 @@ -Subproject commit 32e49929725a76d9871038f30e2ea67fe0e4a4f8 +Subproject commit 11f8336ec93ea3a270c9fe80c4bbb68aa4729423 diff --git a/nuget.package/LibGit2Sharp.nuspec b/nuget.package/LibGit2Sharp.nuspec index 85805227f..3bacd546a 100644 --- a/nuget.package/LibGit2Sharp.nuspec +++ b/nuget.package/LibGit2Sharp.nuspec @@ -1,5 +1,5 @@ - + $id$ $version$ @@ -12,10 +12,13 @@ https://github.com/libgit2/libgit2sharp/blob/master/CHANGES.md#libgit2sharp-changes https://github.com/libgit2/libgit2sharp/raw/master/square-logo.png libgit2 git wrapper bindings API dvcs vcs + + + - - + + diff --git a/nuget.package/Tools/GetLibGit2SharpPostBuildCmd.ps1 b/nuget.package/Tools/GetLibGit2SharpPostBuildCmd.ps1 index 6d4a41fa2..eb32fe37d 100644 --- a/nuget.package/Tools/GetLibGit2SharpPostBuildCmd.ps1 +++ b/nuget.package/Tools/GetLibGit2SharpPostBuildCmd.ps1 @@ -1,7 +1,7 @@ $solutionDir = [System.IO.Path]::GetDirectoryName($dte.Solution.FullName) + "\" $path = $installPath.Replace($solutionDir, "`$(SolutionDir)") -$NativeAssembliesDir = Join-Path $path "NativeBinaries" +$NativeAssembliesDir = Join-Path $path "lib\net35\NativeBinaries" $x86 = $(Join-Path $NativeAssembliesDir "x86\*.*") $x64 = $(Join-Path $NativeAssembliesDir "amd64\*.*")