Skip to content

Commit 88ab1ed

Browse files
committed
Rebase: fixup meta test warnings
1 parent d40497c commit 88ab1ed

8 files changed

+66
-17
lines changed

LibGit2Sharp.Tests/RebaseFixture.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -222,6 +222,7 @@ public void RebaseWhileAlreadyRebasingThrows()
222222
}
223223
}
224224

225+
[Fact]
225226
public void CurrentRebaseOperationIsNullWhenNotRebasing()
226227
{
227228
SelfCleaningDirectory scd = BuildSelfCleaningDirectory();

LibGit2Sharp/AfterRebaseStepInfo.cs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,12 @@ namespace LibGit2Sharp
1010
/// </summary>
1111
public class AfterRebaseStepInfo
1212
{
13+
/// <summary>
14+
/// Needed for mocking.
15+
/// </summary>
16+
protected AfterRebaseStepInfo()
17+
{ }
18+
1319
internal AfterRebaseStepInfo(RebaseStepInfo stepInfo, ObjectId commitId)
1420
{
1521
StepInfo = stepInfo;
@@ -19,11 +25,11 @@ internal AfterRebaseStepInfo(RebaseStepInfo stepInfo, ObjectId commitId)
1925
/// <summary>
2026
/// The info on the completed step.
2127
/// </summary>
22-
public RebaseStepInfo StepInfo { get; private set; }
28+
public virtual RebaseStepInfo StepInfo { get; private set; }
2329

2430
/// <summary>
2531
/// The ID of the commit generated by the step, if any.
2632
/// </summary>
27-
public ObjectId CommitId { get; private set; }
33+
public virtual ObjectId CommitId { get; private set; }
2834
}
2935
}

LibGit2Sharp/BeforeRebaseStepInfo.cs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,12 @@ namespace LibGit2Sharp
1010
/// </summary>
1111
public class BeforeRebaseStepInfo
1212
{
13+
/// <summary>
14+
/// Needed for mocking.
15+
/// </summary>
16+
protected BeforeRebaseStepInfo()
17+
{ }
18+
1319
internal BeforeRebaseStepInfo(RebaseStepInfo stepInfo)
1420
{
1521
StepInfo = stepInfo;
@@ -18,6 +24,6 @@ internal BeforeRebaseStepInfo(RebaseStepInfo stepInfo)
1824
/// <summary>
1925
/// Information on the step that is about to be performed.
2026
/// </summary>
21-
public RebaseStepInfo StepInfo { get; private set; }
27+
public virtual RebaseStepInfo StepInfo { get; private set; }
2228
}
2329
}

LibGit2Sharp/IRepository.cs

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -222,6 +222,24 @@ public interface IRepository : IDisposable
222222
/// <returns>The <see cref="MergeResult"/> of the merge.</returns>
223223
MergeResult Merge(string committish, Signature merger, MergeOptions options);
224224

225+
/// <summary>
226+
/// Perform a rebase.
227+
/// </summary>
228+
/// <param name="branch">The branch to rebase.</param>
229+
/// <param name="upstream">The starting commit to rebase.</param>
230+
/// <param name="onto">The branch to rebase onto.</param>
231+
/// <param name="committer"></param>
232+
/// <param name="options"></param>
233+
/// <returns>true if completed successfully, false if conflicts encountered.</returns>
234+
RebaseResult Rebase(Branch branch, Branch upstream, Branch onto, Signature committer, RebaseOptions options);
235+
236+
/// <summary>
237+
/// Get the current rebase operation in progress (if any).
238+
/// Currently only returns for rebase merge. If a rebase merge
239+
/// operation is not progress, returns null.
240+
/// </summary>
241+
RebaseOperation CurrentRebaseOperation { get; }
242+
225243
/// <summary>
226244
/// Merge the reference that was recently fetched. This will merge
227245
/// the branch on the fetched remote that corresponded to the

LibGit2Sharp/RebaseOperation.cs

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,12 @@ public class RebaseOperation
5353
{
5454
internal readonly Repository repository;
5555

56+
/// <summary>
57+
/// Needed for mocking purposes.
58+
/// </summary>
59+
protected RebaseOperation()
60+
{ }
61+
5662
internal RebaseOperation(Repository repo)
5763
{
5864
this.repository = repo;
@@ -61,7 +67,7 @@ internal RebaseOperation(Repository repo)
6167
/// <summary>
6268
/// Continue the current rebase.
6369
/// </summary>
64-
public RebaseResult Continue(Signature committer, RebaseOptions options)
70+
public virtual RebaseResult Continue(Signature committer, RebaseOptions options)
6571
{
6672
Ensure.ArgumentNotNull(committer, "committer");
6773

@@ -104,7 +110,7 @@ public RebaseResult Continue(Signature committer, RebaseOptions options)
104110
/// <summary>
105111
/// Abort the rebase operation.
106112
/// </summary>
107-
public void Abort()
113+
public virtual void Abort()
108114
{
109115
RebaseSafeHandle rebase = null;
110116
try
@@ -122,15 +128,15 @@ public void Abort()
122128
/// <summary>
123129
/// Skip this rebase step.
124130
/// </summary>
125-
public void Skip()
131+
public virtual void Skip()
126132
{
127133
throw new NotImplementedException();
128134
}
129135

130136
/// <summary>
131137
/// The info on the current step.
132138
/// </summary>
133-
public RebaseStepInfo CurrentStepInfo
139+
public virtual RebaseStepInfo CurrentStepInfo
134140
{
135141
get
136142
{

LibGit2Sharp/RebaseOptions.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ namespace LibGit2Sharp
1010
/// <summary>
1111
/// Options controlling rebase behavior.
1212
/// </summary>
13-
public class RebaseOptions : IConvertableToGitCheckoutOpts
13+
public sealed class RebaseOptions : IConvertableToGitCheckoutOpts
1414
{
1515
/// <summary>
1616
/// Delegate that is called before each rebase step.

LibGit2Sharp/RebaseResult.cs

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,12 @@ public enum RebaseStatus
3232
/// </summary>
3333
public class RebaseResult
3434
{
35+
/// <summary>
36+
/// Needed for mocking.
37+
/// </summary>
38+
protected RebaseResult()
39+
{ }
40+
3541
internal RebaseResult(RebaseStatus status,
3642
int stepNumber,
3743
int totalSteps,
@@ -48,23 +54,23 @@ internal RebaseResult(RebaseStatus status,
4854
/// If the overall Rebase operation has completed successfully, this will
4955
/// be null.
5056
/// </summary>
51-
public RebaseStepInfo CurrentStepInfo { get; private set; }
57+
public virtual RebaseStepInfo CurrentStepInfo { get; private set; }
5258

5359
/// <summary>
5460
/// Did the rebase operation run until it should stop
5561
/// (completed the rebase, or the operation for the current step
5662
/// is one that sequencing should stop.
5763
/// </summary>
58-
public RebaseStatus Status { get; protected set; }
64+
public virtual RebaseStatus Status { get; protected set; }
5965

6066
/// <summary>
6167
/// The number of completed steps.
6268
/// </summary>
63-
public int CompletedStepCount { get; protected set; }
69+
public virtual int CompletedStepCount { get; protected set; }
6470

6571
/// <summary>
6672
/// The total number of steps in the rebase.
6773
/// </summary>
68-
public int TotalStepCount { get; protected set; }
74+
public virtual int TotalStepCount { get; protected set; }
6975
}
7076
}

LibGit2Sharp/RebaseStepInfo.cs

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,12 @@ namespace LibGit2Sharp
1111
/// </summary>
1212
public class RebaseStepInfo
1313
{
14+
/// <summary>
15+
/// Needed for mocking purposes.
16+
/// </summary>
17+
protected RebaseStepInfo()
18+
{ }
19+
1420
internal RebaseStepInfo(RebaseStepOperation type, ObjectId id, string exec, int stepIndex, int totalStepCount)
1521
{
1622
Type = type;
@@ -23,26 +29,26 @@ internal RebaseStepInfo(RebaseStepOperation type, ObjectId id, string exec, int
2329
/// <summary>
2430
/// The rebase operation type.
2531
/// </summary>
26-
public RebaseStepOperation Type { get; private set; }
32+
public virtual RebaseStepOperation Type { get; private set; }
2733

2834
/// <summary>
2935
/// The object ID the step is operating on.
3036
/// </summary>
31-
public ObjectId ID { get; private set; }
37+
public virtual ObjectId ID { get; private set; }
3238

3339
/// <summary>
3440
/// Command to execute, if any.
3541
/// </summary>
36-
public string Exec { get; private set; }
42+
public virtual string Exec { get; private set; }
3743

3844
/// <summary>
3945
/// The index of this step.
4046
/// </summary>
41-
public int StepIndex { get; private set; }
47+
public virtual int StepIndex { get; private set; }
4248

4349
/// <summary>
4450
/// The total number of steps.
4551
/// </summary>
46-
public int TotalStepCount { get; private set; }
52+
public virtual int TotalStepCount { get; private set; }
4753
}
4854
}

0 commit comments

Comments
 (0)