8000 Deprecate ReflogEntry.Commiter in favor of ReflogEntry.Committer · GiTechLab/libgit2sharp@ca7b9be · GitHub
[go: up one dir, main page]

Skip to content

Commit ca7b9be

Browse files
committed
Deprecate ReflogEntry.Commiter in favor of ReflogEntry.Committer
1 parent c6532ce commit ca7b9be

File tree

5 files changed

+32
-22
lines changed

5 files changed

+32
-22
lines changed

LibGit2Sharp.Tests/CheckoutFixture.cs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,8 @@ public void CanCheckoutAnExistingBranch(string branchName)
5151
var reflogEntry = repo.Refs.Log(repo.Refs.Head).First();
5252
Assert.Equal(master.Tip.Id, reflogEntry.From);
5353
Assert.Equal(branch.Tip.Id, reflogEntry.To);
54-
Assert.NotNull(reflogEntry.Commiter.Email);
55-
Assert.NotNull(reflogEntry.Commiter.Name);
54+
Assert.NotNull(reflogEntry.Committer.Email);
55+
Assert.NotNull(reflogEntry.Committer.Name);
5656
Assert.Equal(string.Format("checkout: moving from master to {0}", branchName), reflogEntry.Message);
5757
}
5858
}
@@ -89,8 +89,8 @@ public void CanCheckoutAnExistingBranchByName(string branchName)
8989
var reflogEntry = repo.Refs.Log(repo.Refs.Head).First();
9090
Assert.Equal(master.Tip.Id, reflogEntry.From);
9191
Assert.Equal(repo.Branches[branchName].Tip.Id, reflogEntry.To);
92-
Assert.NotNull(reflogEntry.Commiter.Email);
93-
Assert.NotNull(reflogEntry.Commiter.Name);
92+
Assert.NotNull(reflogEntry.Committer.Email);
93+
Assert.NotNull(reflogEntry.Committer.Name);
9494
Assert.Equal(string.Format("checkout: moving from master to {0}", branchName), reflogEntry.Message);
9595
}
9696
}
@@ -138,8 +138,8 @@ public void CanCheckoutAnArbitraryCommit(string commitPointer, bool checkoutByCo
138138
var reflogEntry = repo.Refs.Log(repo.Refs.Head).First();
139139
Assert.Equal(master.Tip.Id, reflogEntry.From);
140140
Assert.Equal(commit.Sha, reflogEntry.To.Sha);
141-
Assert.NotNull(reflogEntry.Commiter.Email);
142-
Assert.NotNull(reflogEntry.Commiter.Name);
141+
Assert.NotNull(reflogEntry.Committer.Email);
142+
Assert.NotNull(reflogEntry.Committer.Name);
143143
Assert.Equal(string.Format("checkout: moving from master to {0}", expectedReflogTarget), reflogEntry.Message);
144144
}
145145
}
@@ -769,8 +769,8 @@ public void CheckoutFromDetachedHead(string commitPointer)
769769
var reflogEntry = repo.Refs.Log(repo.Refs.Head).First();
770770
Assert.Equal(initialHead.Tip.Id, reflogEntry.From);
771771
Assert.Equal(commitSha, reflogEntry.To.Sha);
772-
Assert.NotNull(reflogEntry.Commiter.Email);
773-
Assert.NotNull(reflogEntry.Commiter.Name);
772+
Assert.NotNull(reflogEntry.Committer.Email);
773+
Assert.NotNull(reflogEntry.Committer.Name);
774774
Assert.Equal(string.Format("checkout: moving from {0} to {1}", initialHead.Tip.Sha, commitPointer), reflogEntry.Message);
775775
}
776776
}

LibGit2Sharp.Tests/CommitFixture.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -615,8 +615,8 @@ public void CommitParentsAreMergeHeads()
615615
// Assert reflog entry is created
616616
var reflogEntry = repo.Refs.Log(repo.R 67ED efs.Head).First();
617617
Assert.Equal(repo.Head.Tip.Id, reflogEntry.To);
618-
Assert.NotNull(reflogEntry.Commiter.Email);
619-
Assert.NotNull(reflogEntry.Commiter.Name);
618+
Assert.NotNull(reflogEntry.Committer.Email);
619+
Assert.NotNull(reflogEntry.Committer.Name);
620620
Assert.Equal(string.Format("commit (merge): {0}", newMergedCommit.MessageShort), reflogEntry.Message);
621621
}
622622
}
@@ -691,7 +691,7 @@ public void CanCommitALittleBit()
691691
// Assert a reflog entry is created on HEAD
692692
Assert.Equal(1, repo.Refs.Log("HEAD").Count());
693693
var reflogEntry = repo.Refs.Log("HEAD").First();
694-
Assert.Equal(author, reflogEntry.Commiter);
694+
Assert.Equal(author, reflogEntry.Committer);
695695
Assert.Equal(commit.Id, reflogEntry.To);
696696
Assert.Equal(ObjectId.Zero, reflogEntry.From);
697697
Assert.Equal(string.Format("commit (initial): {0}", shortMessage), reflogEntry.Message);

LibGit2Sharp.Tests/ReflogFixture.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ public void CanReadReflog()
2121
Assert.Equal(expectedReflogEntriesCount, reflog.Count());
2222

2323
// Initial commit assertions
24-
Assert.Equal("timothy.clem@gmail.com", reflog.Last().Commiter.Email);
24+
Assert.Equal("timothy.clem@gmail.com", reflog.Last().Committer.Email);
2525
Assert.True(reflog.Last().Message.StartsWith("clone: from"));
2626
Assert.Equal(ObjectId.Zero, reflog.Last().From);
2727

@@ -74,14 +74,14 @@ public void CommitShouldCreateReflogEntryOnHeadAndOnTargetedDirectReference()
7474
// Assert a reflog entry is created on HEAD
7575
Assert.Equal(1, repo.Refs.Log("HEAD").Count());
7676
var reflogEntry = repo.Refs.Log("HEAD").First();
77-
Assert.Equal(author, reflogEntry.Commiter);
77+
Assert.Equal(author, reflogEntry.Committer);
7878
Assert.Equal(commit.Id, reflogEntry.To);
7979
Assert.Equal(ObjectId.Zero, reflogEntry.From);
8080

8181
// Assert the same reflog entry is created on refs/heads/master
8282
Assert.Equal(1, repo.Refs.Log("refs/heads/master").Count());
8383
reflogEntry = repo.Refs.Log("HEAD").First();
84-
Assert.Equal(author, reflogEntry.Commiter);
84+
Assert.Equal(author, reflogEntry.Committer);
8585
Assert.Equal(commit.Id, reflogEntry.To);
8686
Assert.Equal(ObjectId.Zero, reflogEntry.From);
8787

@@ -134,7 +134,7 @@ public void CommitOnDetachedHeadShouldInsertReflogEntry()
134134

135135
// Assert a reflog entry is created on HEAD
136136
var reflogEntry = repo.Refs.Log("HEAD").First();
137-
Assert.Equal(author, reflogEntry.Commiter);
137+
Assert.Equal(author, reflogEntry.Committer);
138138
Assert.Equal(commit.Id, reflogEntry.To);
139139
Assert.Equal(string.Format("commit: {0}", commitMessage), repo.Refs.Log("HEAD").First().Message);
140140
}

LibGit2Sharp.Tests/TestHelpers/BaseFixture.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -415,8 +415,8 @@ protected static void AssertRefLogEntry(IRepository repo, string canonicalName,
415415
Assert.Equal(@from ?? ObjectId.Zero, reflogEntry.From);
416416

417417
committer = committer ?? repo.Config.BuildSignature(DateTimeOffset.Now);
418-
Assert.Equal(committer.Email, reflogEntry.Commiter.Email);
419-
Assert.InRange(reflogEntry.Commiter.When, committer.When - TimeSpan.FromSeconds(5), committer.When);
418+
Assert.Equal(committer.Email, reflogEntry.Committer.Email);
419+
Assert.InRange(reflogEntry.Committer.When, committer.When - TimeSpan.FromSeconds(5), committer.When);
420420
}
421421

422422
protected static void EnableRefLog(IRepository repository, bool enable = true)

LibGit2Sharp/ReflogEntry.cs

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
using System.Runtime.InteropServices;
1+
using System;
2+
using System.Runtime.InteropServices;
23
using LibGit2Sharp.Core;
34

45
namespace LibGit2Sharp
@@ -11,7 +12,7 @@ public class ReflogEntry
1112
{
1213
private readonly ObjectId _from;
1314
private readonly ObjectId _to;
14-
private readonly Signature _commiter;
15+
private readonly Signature _committer;
1516
private readonly string message;
1617

1718
/// <summary>
@@ -28,7 +29,7 @@ public ReflogEntry(SafeHandle entryHandle)
2829
{
2930
_from = Proxy.git_reflog_entry_id_old(entryHandle);
3031
_to = Proxy.git_reflog_entry_id_new(entryHandle);
31-
_commiter = Proxy.git_reflog_entry_committer(entryHandle);
32+
_committer = Proxy.git_reflog_entry_committer(entryHandle);
3233
message = Proxy.git_reflog_entry_message(entryHandle);
3334
}
3435

@@ -49,11 +50,20 @@ public virtual ObjectId To
4950
}
5051

5152
/// <summary>
52-
/// <see cref="Signature"/> of the commiter of this reference update
53+
/// <see cref="Signature"/> of the committer of this reference update
5354
/// </summary>
55+
public virtual Signature Committer
56+
{
57+
get { return _committer; }
58+
}
59+
60+
/// <summary>
61+
/// <see cref="Signature"/> of the committer of this reference update
62+
/// </summary>
63+
[Obsolete("This property will be removed in the next release. Please use Committer instead.")]
5464
public virtual Signature Commiter
5565
{
56-
get { return _commiter; }
66+
get { return Committer; }
5767
}
5868

5969
/// <summary>

0 commit comments

Comments
 (0)
0