Skip to content

Commit b69e3e2

Browse files
committed
Obsolete repo.Commit() overloads that do not require Signature parameters
1 parent 818654b commit b69e3e2

File tree

4 files changed

+28
-22
lines changed

4 files changed

+28
-22
lines changed

‎LibGit2Sharp.Tests/CommitFixture.cs‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -560,7 +560,9 @@ public void CanCommitWithSignatureFromConfig()
560560

561561
Assert.Null(repo.Head[relativeFilepath]);
562562

563-
Commitcommit=repo.Commit("Initial egotistic commit");
563+
Signaturesignature=repo.Config.BuildSignature(DateTimeOffset.Now);
564+
565+
Commitcommit=repo.Commit("Initial egotistic commit",signature,signature);
564566

565567
AssertBlobContent(repo.Head[relativeFilepath],"nulltoken\n");
566568
AssertBlobContent(commit[relativeFilepath],"nulltoken\n");

‎LibGit2Sharp.Tests/FilterFixture.cs‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ public void CleanFilterWritesOutputToObjectTree()
159159
using(varrepo=CreateTestRepository(repoPath))
160160
{
161161
FileInfoexpectedFile=StageNewFile(repo,decodedInput);
162-
varcommit=repo.Commit("Clean that file");
162+
varcommit=repo.Commit("Clean that file",Constants.Signature,Constants.Signature);
163163
varblob=(Blob)commit.Tree[expectedFile.Name].Target;
164164

165165
vartextDetected=blob.GetContentText();
@@ -240,7 +240,7 @@ public void CanFilterLargeFiles()
240240
File.WriteAllText(attributesPath,"*.blob filter=test");
241241
repo.Stage(attributesFile.Name);
242242
repo.Stage(contentFile.Name);
243-
repo.Commit("test");
243+
repo.Commit("test",Constants.Signature,Constants.Signature);
244244
contentFile.Delete();
245245
repo.Checkout("HEAD",newCheckoutOptions(){CheckoutModifiers=CheckoutModifiers.Force});
246246
}
@@ -346,7 +346,7 @@ private FileInfo CheckoutFileForSmudge(string repoPath, string branchName, strin
346346
{
347347
StageNewFile(repo,content);
348348

349-
repo.Commit("Initial commit");
349+
repo.Commit("Initial commit",Constants.Signature,Constants.Signature);
350350

351351
expectedPath=CommitFileOnBranch(repo,branchName,content);
352352

@@ -363,7 +363,7 @@ private static FileInfo CommitFileOnBranch(Repository repo, string branchName, S
363363
repo.Checkout(branch.FriendlyName);
364364

365365
FileInfoexpectedPath=StageNewFile(repo,content);
366-
repo.Commit("Commit");
366+
repo.Commit("Commit",Constants.Signature,Constants.Signature);
367367
returnexpectedPath;
368368
}
369369

‎LibGit2Sharp.Tests/FilterSubstitutionCipherFixture.cs‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -203,15 +203,15 @@ private static void DeleteFile(Repository repo, string fileName)
203203
{
204204
File.Delete(Path.Combine(repo.Info.WorkingDirectory,fileName));
205205
repo.Stage(fileName);
206-
repo.Commit("remove file");
206+
repo.Commit("remove file",Constants.Signature,Constants.Signature);
207207
}
208208

209209
privatestaticBlobCommitOnBranchAndReturnDatabaseBlob(Repositoryrepo,stringfileName,stringinput)
210210
{
211211
Touch(repo.Info.WorkingDirectory,fileName,input);
212212
repo.Stage(fileName);
213213

214-
varcommit=repo.Commit("new file");
214+
varcommit=repo.Commit("new file",Constants.Signature,Constants.Signature);
215215

216216
varblob=(Blob)commit.Tree[fileName].Target;
217217
returnblob;

‎LibGit2Sharp/RepositoryExtensions.cs‎

Lines changed: 19 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -219,6 +219,7 @@ private static Commit LookUpCommit(IRepository repository, string committish)
219219
/// <param name="repository">The <see cref="Repository"/> being worked with.</param>
220220
/// <param name="message">The description of why a change was made to the repository.</param>
221221
/// <returns>The generated <see cref="LibGit2Sharp.Commit"/>.</returns>
222+
[Obsolete("This method will be removed in the next release. Please use Commit(string, Signature, Signature) instead.")]
222223
publicstaticCommitCommit(thisIRepositoryrepository,stringmessage)
223224
{
224225
returnrepository.Commit(message,(CommitOptions)null);
@@ -234,6 +235,7 @@ public static Commit Commit(this IRepository repository, string message)
234235
/// <param name="message">The description of why a change was made to the repository.</param>
235236
/// <param name="options">The <see cref="CommitOptions"/> that specify the commit behavior.</param>
236237
/// <returns>The generated <see cref="LibGit2Sharp.Commit"/>.</returns>
238+
[Obsolete("This method will be removed in the next release. Please use Commit(string, Signature, Signature, CommitOptions) instead.")]
237239
publicstaticCommitCommit(thisIRepositoryrepository,stringmessage,CommitOptionsoptions)
238240
{
239241
Signatureauthor=repository.Config.BuildSignatureOrThrow(DateTimeOffset.Now);
@@ -251,6 +253,7 @@ public static Commit Commit(this IRepository repository, string message, CommitO
251253
/// <param name="author">The <see cref="Signature"/> of who made the change.</param>
252254
/// <param name="message">The description of why a change was made to the repository.</param>
253255
/// <returns>The generated <see cref="LibGit2Sharp.Commit"/>.</returns>
256+
[Obsolete("This method will be removed in the next release. Please use Commit(string, Signature, Signature) instead.")]
254257
publicstaticCommitCommit(thisIRepositoryrepository,stringmessage,Signatureauthor)
255258
{
256259
returnrepository.Commit(message,author,(CommitOptions)null);
@@ -267,13 +270,29 @@ public static Commit Commit(this IRepository repository, string message, Signatu
267270
/// <param name="message">The description of why a change was made to the repository.</param>
268271
/// <param name="options">The <see cref="CommitOptions"/> that specify the commit behavior.</param>
269272
/// <returns>The generated <see cref="LibGit2Sharp.Commit"/>.</returns>
273+
[Obsolete("This method will be removed in the next release. Please use Commit(string, Signature, Signature, CommitOptions) instead.")]
270274
publicstaticCommitCommit(thisIRepositoryrepository,stringmessage,Signatureauthor,CommitOptionsoptions)
271275
{
272276
Signaturecommitter=repository.Config.BuildSignatureOrThrow(DateTimeOffset.Now);
273277

274278
returnrepository.Commit(message,author,committer,options);
275279
}
276280

281+
/// <summary>
282+
/// Stores the content of the <see cref="Repository.Index"/> as a new <see cref="LibGit2Sharp.Commit"/> into the repository.
283+
/// The tip of the <see cref="Repository.Head"/> will be used as the parent of this new Commit.
284+
/// Once the commit is created, the <see cref="Repository.Head"/> will move forward to point at it.
285+
/// </summary>
286+
/// <param name="repository">The <see cref="IRepository"/> being worked with.</param>
287+
/// <param name="message">The description of why a change was made to the repository.</param>
288+
/// <param name="author">The <see cref="Signature"/> of who made the change.</param>
289+
/// <param name="committer">The <see cref="Signature"/> of who added the change to the repository.</param>
290+
/// <returns>The generated <see cref="LibGit2Sharp.Commit"/>.</returns>
291+
publicstaticCommitCommit(thisIRepositoryrepository,stringmessage,Signatureauthor,Signaturecommitter)
292+
{
293+
returnrepository.Commit(message,author,committer,default(CommitOptions));
294+
}
295+
277296
/// <summary>
278297
/// Fetch from the specified remote.
279298
/// </summary>
@@ -601,21 +620,6 @@ public static void Reset(this IRepository repository, Commit commit)
601620
repository.Index.Replace(commit,null,null);
602621
}
603622

604-
/// <summary>
605-
/// Stores the content of the <see cref="Repository.Index"/> as a new <see cref="LibGit2Sharp.Commit"/> into the repository.
606-
/// The tip of the <see cref="Repository.Head"/> will be used as the parent of this new Commit.
607-
/// Once the commit is created, the <see cref="Repository.Head"/> will move forward to point at it.
608-
/// </summary>
609-
/// <param name="repository">The <see cref="IRepository"/> being worked with.</param>
610-
/// <param name="message">The description of why a change was made to the repository.</param>
611-
/// <param name="author">The <see cref="Signature"/> of who made the change.</param>
612-
/// <param name="committer">The <see cref="Signature"/> of who added the change to the repository.</param>
613-
/// <returns>The generated <see cref="LibGit2Sharp.Commit"/>.</returns>
614-
publicstaticCommitCommit(thisIRepositoryrepository,stringmessage,Signatureauthor,Signaturecommitter)
615-
{
616-
returnrepository.Commit(message,author,committer,null);
617-
}
618-
619623
/// <summary>
620624
/// Find where each line of a file originated.
621625
/// </summary>

0 commit comments

Comments
(0)