Skip to content

Commit d81c08f

Browse files
committed
Various fixups following rebase
1 parent c106763 commit d81c08f

File tree

4 files changed

+19
-32
lines changed

4 files changed

+19
-32
lines changed

LibGit2Sharp.Tests/RebaseFixture.cs

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,5 @@
1-
using System;
2-
using System.Collections.Generic;
3-
using System.IO;
1+
using System.Collections.Generic;
42
using System.Linq;
5-
using System.Text;
6-
using LibGit2Sharp.Core;
73
using LibGit2Sharp.Tests.TestHelpers;
84
using Xunit;
95
using Xunit.Extensions;
@@ -56,7 +52,7 @@ public void CanRebase(string initialBranchName,
5652

5753
RebaseOptions options = new RebaseOptions()
5854
{
59-
RebaseStepStarting = x =>
55+
RebaseStepStarting = x =>
6056
{
6157
beforeStepCallCount++;
6258
PreRebaseCommits.Add(x.StepInfo.Commit);
@@ -346,7 +342,7 @@ public void CanAbortRebase()
346342
Assert.Equal(0, rebaseResult.CompletedStepCount);
347343
Assert.Equal(3, rebaseResult.TotalStepCount);
348344

349-
repo.Rebase.Abort(Constants.Signature);
345+
repo.Rebase.Abort();
350346
Assert.False(repo.RetrieveStatus().IsDirty);
351347
Assert.True(repo.Index.IsFullyMerged);
352348
Assert.Equal(CurrentOperation.None, repo.Info.CurrentOperation);
@@ -396,7 +392,7 @@ public void RebaseOperationsWithoutRebasingThrow()
396392
repo.Rebase.Continue(Constants.Signature, new RebaseOptions()));
397393

398394
Assert.Throws<NotFoundException>(() =>
399-
repo.Rebase.Abort(Constants.Signature));
395+
repo.Rebase.Abort());
400396
}
401397
}
402398

@@ -447,7 +443,7 @@ public void CanRebaseHandlePatchAlreadyApplied()
447443

448444
RebaseOptions options = new RebaseOptions()
449445
{
450-
RebaseStepCompleted = x =>
446+
RebaseStepCompleted = x =>
451447
{
452448
rebaseResults.Add(new CompletedRebaseStepInfo(x.Commit, x.WasPatchAlreadyApplied));
453449
}
@@ -519,7 +515,7 @@ private void ConstructRebaseTestRepository(Repository repo)
519515
repo.Stage(filePathC);
520516
commit = repo.Commit("commit 3", Constants.Signature, Constants.Signature, new CommitOptions());
521517

522-
Branch masterBranch1 = repo.CreateBranch(masterBranch1Name, commit, Constants.Signature);
518+
Branch masterBranch1 = repo.CreateBranch(masterBranch1Name, commit);
523519

524520
Touch(workdir, filePathB, string.Join(lineEnding, fileContentB1, fileContentB2));
525521
repo.Stage(filePathB);
@@ -533,7 +529,7 @@ private void ConstructRebaseTestRepository(Repository repo)
533529
repo.Stage(filePathB);
534530
commit = repo.Commit("commit 6", Constants.Signature, Constants.Signature, new CommitOptions());
535531

536-
repo.CreateBranch(topicBranch1Name, commit, Constants.Signature);
532+
repo.CreateBranch(topicBranch1Name, commit);
537533

538534
Touch(workdir, filePathC, string.Join(lineEnding, fileContentC1, fileContentC2));
539535
repo.Stage(filePathC);
@@ -547,7 +543,7 @@ private void ConstructRebaseTestRepository(Repository repo)
547543
repo.Stage(filePathC);
548544
commit = repo.Commit("commit 9", Constants.Signature, Constants.Signature, new CommitOptions());
549545

550-
repo.CreateBranch(topicBranch2Name, commit, Constants.Signature);
546+
repo.CreateBranch(topicBranch2Name, commit);
551547

552548
repo.Checkout(masterBranch1.Tip);
553549
Touch(workdir, filePathD, fileContentD1);
@@ -562,13 +558,13 @@ private void ConstructRebaseTestRepository(Repository repo)
562558
repo.Stage(filePathD);
563559
commit = repo.Commit("commit 12", Constants.Signature, Constants.Signature, new CommitOptions());
564560

565-
repo.CreateBranch(masterBranch2Name, commit, Constants.Signature);
561+
repo.CreateBranch(masterBranch2Name, commit);
566562

567563
// Create commit / branch that conflicts with T1 and T2
568564
Touch(workdir, filePathB, string.Join(lineEnding, fileContentB1, fileContentB2 + fileContentB3 + fileContentB4));
569565
repo.Stage(filePathB);
570566
commit = repo.Commit("commit 13", Constants.Signature, Constants.Signature, new CommitOptions());
571-
repo.CreateBranch(conflictBranch1Name, commit, Constants.Signature);
567+
repo.CreateBranch(conflictBranch1Name, commit);
572568
}
573569
}
574570
}

LibGit2Sharp/Core/NativeMethods.cs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,6 @@ internal static extern int git_rebase_init(
198198
GitAnnotatedCommitHandle branch,
199199
GitAnnotatedCommitHandle upstream,
200200
GitAnnotatedCommitHandle onto,
201-
GitSignature signature,
202201
ref GitRebaseOptions options);
203202

204203
[DllImport(libgit2)]
@@ -236,8 +235,7 @@ internal static extern int git_rebase_commit(
236235

237236
[DllImport(libgit2)]
238237
internal static extern int git_rebase_abort(
239-
RebaseSafeHandle rebase,
240-
SignatureSafeHandle signature);
238+
RebaseSafeHandle rebase);
241239

242240
[DllImport(libgit2)]
243241
internal static extern int git_rebase_finish(

LibGit2Sharp/Core/Proxy.cs

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1609,14 +1609,13 @@ public static RebaseSafeHandle git_rebase_init(
16091609
GitAnnotatedCommitHandle branch,
16101610
GitAnnotatedCommitHandle upstream,
16111611
GitAnnotatedCommitHandle onto,
1612-
GitSignature signature,
16131612
ref GitRebaseOptions options)
16141613
{
16151614
RebaseSafeHandle rebase = null;
16161615

16171616
using (ThreadAffinity())
16181617
{
1619-
int result = NativeMethods.git_rebase_init(out rebase, repo, branch, upstream, onto, signature, ref options);
1618+
int result = NativeMethods.git_rebase_init(out rebase, repo, branch, upstream, onto, ref options);
16201619
Ensure.ZeroResult(result);
16211620
}
16221621

@@ -1707,7 +1706,7 @@ public static GitRebaseCommitResult git_rebase_commit(
17071706
try
17081707
{
17091708
committerHandle = committer.BuildHandle();
1710-
authorHandle = author == null ?
1709+
authorHandle = author == null ?
17111710
new SignatureSafeHandle() : author.BuildHandle();
17121711

17131712
int result = NativeMethods.git_rebase_commit(ref commitResult.CommitId, rebase, authorHandle, committerHandle, IntPtr.Zero, IntPtr.Zero);
@@ -1753,16 +1752,13 @@ public struct GitRebaseCommitResult
17531752
}
17541753

17551754
public static void git_rebase_abort(
1756-
RebaseSafeHandle rebase,
1757-
Signature signature)
1755+
RebaseSafeHandle rebase)
17581756
{
17591757
Ensure.ArgumentNotNull(rebase, "rebase");
1760-
Ensure.ArgumentNotNull(signature, "signature");
17611758

17621759
using (ThreadAffinity())
1763-
using (var signatureHandle = signature.BuildHandle())
17641760
{
1765-
int result = NativeMethods.git_rebase_abort(rebase, signatureHandle);
1761+
int result = NativeMethods.git_rebase_abort(rebase);
17661762
}
17671763
}
17681764

LibGit2Sharp/Rebase.cs

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -128,10 +128,10 @@ public virtual RebaseResult Start(Branch branch, Branch upstream, Branch onto, S
128128
annotatedBranchCommitHandle,
129129
annotatedUpstreamRefPtrCommitHandle,
130130
annotatedOntoRefPtrCommitHandle,
131-
null, ref gitRebaseOptions);
131+
ref gitRebaseOptions);
132132

133133
RebaseResult rebaseResult =
134-
RebaseOperationImpl.Run(rebaseOperationHandle,
134+
RebaseOperationImpl.Run(rebaseOperationHandle,
135135
this.repository,
136136
committer,
137137
options,
@@ -213,16 +213,13 @@ public virtual RebaseResult Continue(Signature committer, RebaseOptions options)
213213
/// <summary>
214214
/// Abort the rebase operation.
215215
/// </summary>
216-
/// <param name="signature">The <see cref="Signature"/> of who is reborting the rebase.</param>
217-
public virtual void Abort(Signature signature)
216+
public virtual void Abort()
218217
{
219-
Ensure.ArgumentNotNull(signature, "signature");
220-
221218
RebaseSafeHandle rebase = null;
222219
try
223220
{
224221
rebase = Proxy.git_rebase_open(repository.Handle);
225-
Proxy.git_rebase_abort(rebase, signature);
222+
Proxy.git_rebase_abort(rebase);
226223
}
227224
finally
228225
{

0 commit comments

Comments
 (0)