Skip to content

Commit 3272834

Browse files
committed
Delete dead code
1 parent 6a966c5 commit 3272834

File tree

2 files changed

+0
-42
lines changed

2 files changed

+0
-42
lines changed

src/NerdBank.GitVersioning.Tests/LibGit2GitExtensionsTests.cs

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -166,22 +166,6 @@ public void GetVersionHeight_ProgressAndReset(string version1, string version2,
166166
Assert.Equal(!versionHeightReset, height2 > height1);
167167
}
168168

169-
[Fact]
170-
public void GetTruncatedCommitIdAsInteger_Roundtrip()
171-
{
172-
var firstCommit = this.LibGit2Repository.Commit("First", this.Signer, this.Signer, new CommitOptions { AllowEmptyCommit = true });
173-
var secondCommit = this.LibGit2Repository.Commit("Second", this.Signer, this.Signer, new CommitOptions { AllowEmptyCommit = true });
174-
175-
int id1 = firstCommit.GetTruncatedCommitIdAsInt32();
176-
int id2 = secondCommit.GetTruncatedCommitIdAsInt32();
177-
178-
this.Logger.WriteLine($"Commit {firstCommit.Id.Sha.Substring(0, 8)} as int: {id1}");
179-
this.Logger.WriteLine($"Commit {secondCommit.Id.Sha.Substring(0, 8)} as int: {id2}");
180-
181-
Assert.Equal(firstCommit, this.LibGit2Repository.GetCommitFromTruncatedIdInteger(id1));
182-
Assert.Equal(secondCommit, this.LibGit2Repository.GetCommitFromTruncatedIdInteger(id2));
183-
}
184-
185169
[Fact]
186170
public void GetIdAsVersion_ReadsMajorMinorFromVersionTxt()
187171
{

src/NerdBank.GitVersioning/LibGit2/LibGit2GitExtensions.cs

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -97,18 +97,6 @@ public static int GetHeight(LibGit2Context context, Func<Commit, bool>? continue
9797
return GetCommitHeight(context.Commit, tracker, continueStepping);
9898
}
9999

100-
/// <summary>
101-
/// Takes the first 4 bytes of a commit ID (i.e. first 8 characters of its hex-encoded SHA)
102-
/// and returns them as an integer.
103-
/// </summary>
104-
/// <param name="commit">The commit to identify with an integer.</param>
105-
/// <returns>The integer which identifies a commit.</returns>
106-
public static int GetTruncatedCommitIdAsInt32(this Commit commit)
107-
{
108-
Requires.NotNull(commit, nameof(commit));
109-
return BitConverter.ToInt32(commit.Id.RawId, 0);
110-
}
111-
112100
/// <summary>
113101
/// Takes the first 2 bytes of a commit ID (i.e. first 4 characters of its hex-encoded SHA)
114102
/// and returns them as an 16-bit unsigned integer.
@@ -121,20 +109,6 @@ public static ushort GetTruncatedCommitIdAsUInt16(this Commit commit)
121109
return BitConverter.ToUInt16(commit.Id.RawId, 0);
122110
}
123111

124-
/// <summary>
125-
/// Looks up a commit by an integer that captures the first for bytes of its ID.
126-
/// </summary>
127-
/// <param name="repo">The repo to search for a matching commit.</param>
128-
/// <param name="truncatedId">The value returned from <see cref="GetTruncatedCommitIdAsInt32(Commit)"/>.</param>
129-
/// <returns>A matching commit.</returns>
130-
public static Commit GetCommitFromTruncatedIdInteger(this Repository repo, int truncatedId)
131-
{
132-
Requires.NotNull(repo, nameof(repo));
133-
134-
byte[] rawId = BitConverter.GetBytes(truncatedId);
135-
return repo.Lookup<Commit>(EncodeAsHex(rawId));
136-
}
137-
138112
/// <summary>
139113
/// Returns the repository that <paramref name="repositoryMember"/> belongs to.
140114
/// </summary>

0 commit comments

Comments
 (0)