diff options
author | Edward Thomson <ethomson@microsoft.com> | 2015-03-11 01:48:24 +0300 |
---|---|---|
committer | Edward Thomson <ethomson@microsoft.com> | 2015-04-08 17:10:50 +0300 |
commit | eaf7817ed3b6d5b08323598c8e1fbc9d8cea2ded (patch) | |
tree | ddce3980920cee19068e6d697dcb6031d7ed2c67 | |
parent | b304c070de966c12a025a20208ee76d3026e2e08 (diff) |
Conflicts: take the Index not the Repository
-rw-r--r-- | LibGit2Sharp/ConflictCollection.cs | 14 | ||||
-rw-r--r-- | LibGit2Sharp/Core/Proxy.cs | 1 | ||||
-rw-r--r-- | LibGit2Sharp/Index.cs | 4 | ||||
-rw-r--r-- | LibGit2Sharp/IndexNameEntryCollection.cs | 12 | ||||
-rw-r--r-- | LibGit2Sharp/IndexReucEntryCollection.cs | 14 |
5 files changed, 22 insertions, 23 deletions
diff --git a/LibGit2Sharp/ConflictCollection.cs b/LibGit2Sharp/ConflictCollection.cs index ba8bb8c3..8cd72a3b 100644 --- a/LibGit2Sharp/ConflictCollection.cs +++ b/LibGit2Sharp/ConflictCollection.cs @@ -13,7 +13,7 @@ namespace LibGit2Sharp /// </summary> public class ConflictCollection : IEnumerable<Conflict> { - private readonly Repository repo; + private readonly Index index; /// <summary> /// Needed for mocking purposes. @@ -21,9 +21,9 @@ namespace LibGit2Sharp protected ConflictCollection() { } - internal ConflictCollection(Repository repo) + internal ConflictCollection(Index index) { - this.repo = repo; + this.index = index; } /// <summary> @@ -36,7 +36,7 @@ namespace LibGit2Sharp { get { - return Proxy.git_index_conflict_get(repo.Index.Handle, repo, path); + return Proxy.git_index_conflict_get(index.Handle, path); } } @@ -48,7 +48,7 @@ namespace LibGit2Sharp { get { - return new IndexReucEntryCollection(repo); + return new IndexReucEntryCollection(index); } } @@ -60,7 +60,7 @@ namespace LibGit2Sharp { get { - return new IndexNameEntryCollection(repo); + return new IndexNameEntryCollection(index); } } @@ -72,7 +72,7 @@ namespace LibGit2Sharp IndexEntry ancestor = null, ours = null, theirs = null; string currentPath = null; - foreach (IndexEntry entry in repo.Index) + foreach (IndexEntry entry in index) { if (entry.StageLevel == StageLevel.Staged) { diff --git a/LibGit2Sharp/Core/Proxy.cs b/LibGit2Sharp/Core/Proxy.cs index 93672462..1f8b5bff 100644 --- a/LibGit2Sharp/Core/Proxy.cs +++ b/LibGit2Sharp/Core/Proxy.cs @@ -919,7 +919,6 @@ namespace LibGit2Sharp.Core public static Conflict git_index_conflict_get( IndexSafeHandle index, - Repository repo, FilePath path) { IndexEntrySafeHandle ancestor, ours, theirs; diff --git a/LibGit2Sharp/Index.cs b/LibGit2Sharp/Index.cs index 7aaf95b0..36dd60b7 100644 --- a/LibGit2Sharp/Index.cs +++ b/LibGit2Sharp/Index.cs @@ -30,7 +30,7 @@ namespace LibGit2Sharp this.repo = repo; handle = Proxy.git_repository_index(repo.Handle); - conflicts = new ConflictCollection(repo); + conflicts = new ConflictCollection(this); repo.RegisterForCleanup(handle); } @@ -41,7 +41,7 @@ namespace LibGit2Sharp handle = Proxy.git_index_open(indexPath); Proxy.git_repository_set_index(repo.Handle, handle); - conflicts = new ConflictCollection(repo); + conflicts = new ConflictCollection(this); repo.RegisterForCleanup(handle); } diff --git a/LibGit2Sharp/IndexNameEntryCollection.cs b/LibGit2Sharp/IndexNameEntryCollection.cs index 7be2da97..2896f912 100644 --- a/LibGit2Sharp/IndexNameEntryCollection.cs +++ b/LibGit2Sharp/IndexNameEntryCollection.cs @@ -13,7 +13,7 @@ namespace LibGit2Sharp /// </summary> public class IndexNameEntryCollection : IEnumerable<IndexNameEntry> { - private readonly Repository repo; + private readonly Index index; /// <summary> /// Needed for mocking purposes. @@ -21,16 +21,16 @@ namespace LibGit2Sharp protected IndexNameEntryCollection() { } - internal IndexNameEntryCollection(Repository repo) + internal IndexNameEntryCollection(Index index) { - this.repo = repo; + this.index = index; } - private IndexNameEntry this[int index] + private IndexNameEntry this[int idx] { get { - IndexNameEntrySafeHandle entryHandle = Proxy.git_index_name_get_byindex(repo.Index.Handle, (UIntPtr)index); + IndexNameEntrySafeHandle entryHandle = Proxy.git_index_name_get_byindex(index.Handle, (UIntPtr)idx); return IndexNameEntry.BuildFromPtr(entryHandle); } } @@ -41,7 +41,7 @@ namespace LibGit2Sharp { var list = new List<IndexNameEntry>(); - int count = Proxy.git_index_name_entrycount(repo.Index.Handle); + int count = Proxy.git_index_name_entrycount(index.Handle); for (int i = 0; i < count; i++) { diff --git a/LibGit2Sharp/IndexReucEntryCollection.cs b/LibGit2Sharp/IndexReucEntryCollection.cs index 8fe0be9d..8402a285 100644 --- a/LibGit2Sharp/IndexReucEntryCollection.cs +++ b/LibGit2Sharp/IndexReucEntryCollection.cs @@ -13,7 +13,7 @@ namespace LibGit2Sharp /// </summary> public class IndexReucEntryCollection : IEnumerable<IndexReucEntry> { - private readonly Repository repo; + private readonly Index index; /// <summary> /// Needed for mocking purposes. @@ -21,9 +21,9 @@ namespace LibGit2Sharp protected IndexReucEntryCollection() { } - internal IndexReucEntryCollection(Repository repo) + internal IndexReucEntryCollection(Index index) { - this.repo = repo; + this.index = index; } /// <summary> @@ -35,16 +35,16 @@ namespace LibGit2Sharp { Ensure.ArgumentNotNullOrEmptyString(path, "path"); - IndexReucEntrySafeHandle entryHandle = Proxy.git_index_reuc_get_bypath(repo.Index.Handle, path); + IndexReucEntrySafeHandle entryHandle = Proxy.git_index_reuc_get_bypath(index.Handle, path); return IndexReucEntry.BuildFromPtr(entryHandle); } } - private IndexReucEntry this[int index] + private IndexReucEntry this[int idx] { get { - IndexReucEntrySafeHandle entryHandle = Proxy.git_index_reuc_get_byindex(repo.Index.Handle, (UIntPtr)index); + IndexReucEntrySafeHandle entryHandle = Proxy.git_index_reuc_get_byindex(index.Handle, (UIntPtr)idx); return IndexReucEntry.BuildFromPtr(entryHandle); } } @@ -55,7 +55,7 @@ namespace LibGit2Sharp { var list = new List<IndexReucEntry>(); - int count = Proxy.git_index_reuc_entrycount(repo.Index.Handle); + int count = Proxy.git_index_reuc_entrycount(index.Handle); for (int i = 0; i < count; i++) { |