8000 Conflicts: take the Index not the Repository · thatfrankdev/libgit2sharp@eaf7817 · GitHub
[go: up one dir, main page]

Skip to content

Commit eaf7817

Browse files
author
Edward Thomson
committed
Conflicts: take the Index not the Repository
1 parent b304c07 commit eaf7817

File tree

5 files changed

+22
-23
lines changed

5 files changed

+22
-23
lines changed

LibGit2Sharp/ConflictCollection.cs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,17 +13,17 @@ namespace LibGit2Sharp
1313
/// </summary>
1414
public class ConflictCollection : IEnumerable<Conflict>
1515
{
16-
private readonly Repository repo;
16+
private readonly Index index;
1717

1818
/// <summary>
1919
/// Needed for mocking purposes.
2020
/// </summary>
2121
protected ConflictCollection()
2222
{ }
2323

24-
internal ConflictCollection(Repository repo)
24+
internal ConflictCollection(Index index)
2525
{
26-
this.repo = repo;
26+
this.index = index;
2727
}
2828

2929
/// <summary>
@@ -36,7 +36,7 @@ public virtual Conflict this[string path]
3636
{
3737
get
3838
{
39-
return Proxy.git_index_conflict_get(repo.Index.Handle, repo, path);
39+
return Proxy.git_index_conflict_get(index.Handle, path);
4040
}
4141
}
4242

@@ -48,7 +48,7 @@ public virtual IndexReucEntryCollection ResolvedConflicts
4848
{
4949
get
5050
{
51-
return new IndexReucEntryCollection(repo);
51+
return new IndexReucEntryCollection(index);
5252
}
5353
}
5454

@@ -60,7 +60,7 @@ public virtual IndexNameEntryCollection Names
6060
{
6161
get
6262
{
63-
return new IndexNameEntryCollection(repo);
63+
return new IndexNameEntryCollection(index);
6464
}
6565
}
6666

@@ -72,7 +72,7 @@ private List<Conflict> AllConflicts()
7272
IndexEntry ancestor = null, ours = null, theirs = null;
7373
string currentPath = null;
7474

75-
foreach (IndexEntry entry in repo.Index)
75+
foreach (IndexEntry entry in index)
7676
{
7777
if (entry.StageLevel == StageLevel.Staged)
7878
{

LibGit2Sharp/Core/Proxy.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -919,7 +919,6 @@ public static void git_index_add_bypath(IndexSafeHandle index, FilePath path)
919919

920920
public static Conflict git_index_conflict_get(
921921
IndexSafeHandle index,
922-
Repository repo,
923922
FilePath path)
924923
{
925924
IndexEntrySafeHandle ancestor, ours, theirs;

LibGit2Sharp/Index.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ internal Index(Repository repo)
3030
this.repo = repo;
3131

3232
handle = Proxy.git_repository_index(repo.Handle);
33-
conflicts = new ConflictCollection(repo);
33+
conflicts = new ConflictCollection(this);
3434

3535
repo.RegisterForCleanup(handle);
3636
}
@@ -41,7 +41,7 @@ internal Index(Repository repo, string indexPath)
4141

4242
handle = Proxy.git_index_open(indexPath);
4343
Proxy.git_repository_set_index(repo.Handle, handle);
44-
conflicts = new ConflictCollection(repo);
44+
conflicts = new ConflictCollection(this);
4545

4646
repo.RegisterForCleanup(handle);
4747
}

LibGit2Sharp/IndexNameEntryCollection.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,24 +13,24 @@ namespace LibGit2Sharp
1313
/// </summary>
1414
public class IndexNameEntryCollection : IEnumerable<IndexNameEntry>
1515
{
16-
private readonly Repository repo;
16+
private readonly Index index;
1717

1818
/// <summary>
1919
/// Needed for mocking purposes.
2020
/// </summary>
2121
protected IndexNameEntryCollection()
2222
{ }
2323

24-
internal IndexNameEntryCollection(Repository repo)
24+
internal IndexNameEntryCollection(Index index)
2525
{
26-
this.repo = repo;
26+
this.index = index;
2727
}
2828

29-
private IndexNameEntry this[int index]
29+
private IndexNameEntry this[int idx]
3030
{
3131
get
3232
{
33-
IndexNameEntrySafeHandle entryHandle = Proxy.git_index_name_get_byindex(repo.Index.Handle, (UIntPtr)index);
33+
IndexNameEntrySafeHandle entryHandle = Proxy.git_index_name_get_byindex(index.Handle, (UIntPtr)idx);
3434
return IndexNameEntry.BuildFromPtr(entryHandle);
3535
}
3636
}
@@ -41,7 +41,7 @@ private List<IndexNameEntry> AllIndexNames()
4141
{
4242
var list = new List<IndexNameEntry>();
4343

44-
int count = Proxy.git_index_name_entrycount(repo.Index.Handle);
44+
int count = Proxy.git_index_name_entrycount(index.Handle);
4545

4646
for (int i = 0; i < count; i++)
4747
{

LibGit2Sharp/IndexReucEntryCollection.cs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,17 +13,17 @@ namespace LibGit2Sharp
1313
/// </summary>
1414
public class IndexReucEntryCollection : IEnumerable<IndexReucEntry>
1515
{
16-
private readonly Repository repo;
16+
private readonly Index index;
1717

1818
/// <summary>
1919
/// Needed for mocking purposes.
2020
/// </summary>
2121
protected IndexReucEntryCollection()
2222
{ }
2323

24-
internal IndexReucEntryCollection(Repository repo)
24+
internal IndexReucEntryCollection(Index index)
2525
{
26-
this.repo = repo;
26+
this.index = index;
2727
}
2828

2929
/// <summary>
@@ -35,16 +35,16 @@ public virtual IndexReucEntry this[string path]
3535
{
3636
Ensure.ArgumentNotNullOrEmptyString(path, "path");
3737

38-
IndexReucEntrySafeHandle entryHandle = Proxy.git_index_reuc_get_bypath(repo.Index.Handle, path);
38+
IndexReucEntrySafeHandle entryHandle = Proxy.git_index_reuc_get_bypath(index.Handle, path);
3939
return IndexReucEntry.BuildFromPtr(entryHandle);
4040
}
4141
}
4242

43-
private IndexReucEntry this[int index]
43+
private IndexReucEntry this[int idx]
4444
{
4545
get
4646
{
47-
IndexReucEntrySafeHandle entryHandle = Proxy.git_index_reuc_get_byindex(repo.Index.Handle, (UIntPtr)index);
47+
IndexReucEntrySafeHandle entryHandle = Proxy.git_index_reuc_get_byindex(index.Handle, (UIntPtr)idx);
4848
return IndexReucEntry.BuildFromPtr(entryHandle);
4949
}
5050
}
@@ -55,7 +55,7 @@ private List<IndexReucEntry> AllIndexReucs()
5555
{
5656
var list = new List<IndexReucEntry>();
5757

58-
int count = Proxy.git_index_reuc_entrycount(repo.Index.Handle);
58+
int count = Proxy.git_index_reuc_entrycount(index.Handle);
5959

6060
for (int i = 0; i < count; i++)
6161
{

0 commit comments

Comments
 (0)
0