8000 Rename RebaseOperation property and add tests · SinghVarun/libgit2sharp@b01721e · GitHub
[go: up one dir, main page]

Skip to content

Commit b01721e

Browse files
committed
Rename RebaseOperation property and add tests
1 parent 7508c53 commit b01721e

File tree

3 files changed

+32
-13
lines changed

3 files changed

+32
-13
lines changed

LibGit2Sharp.Tests/RebaseFixture.cs

Lines changed: 29 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ public void CanRebase(string initialBranchName, string branchName, string upstre
4747
RebaseStepCompleted = x => afterStepCallCount++,
4848
};
4949

50-
RebaseResult rebaseResult = repo.RebaseOperation.Start(branch, upstream, onto, Constants.Signature, options);
50+
RebaseResult rebaseResult = repo.Rebase.Start(branch, upstream, onto, Constants.Signature, options);
5151

5252
// Validation:
5353
Assert.Equal(RebaseStatus.Complete, rebaseResult.Status);
@@ -90,7 +90,7 @@ public void CanContinueRebase()
9090
RebaseStepCompleted = x => afterStepCallCount++,
9191
};
9292

93-
RebaseResult rebaseResult = repo.RebaseOperation.Start(branch, upstream, onto, Constants.Signature, options);
93+
RebaseResult rebaseResult = repo.Rebase.Start(branch, upstream, onto, Constants.Signature, options);
9494

9595
// Verify that we have a conflict.
9696
Assert.Equal(CurrentOperation.RebaseMerge, repo.Info.CurrentOperation);
@@ -114,7 +114,7 @@ public void CanContinueRebase()
114114

115115
Assert.True(repo.Index.IsFullyMerged);
116116

117-
RebaseResult continuedRebaseResult = repo.RebaseOperation.Continue(Constants.Signature, options);
117+
RebaseResult continuedRebaseResult = repo.Rebase.Continue(Constants.Signature, options);
118118

119119
Assert.NotNull(continuedRebaseResult);
120120
Assert.Equal(RebaseStatus.Complete, continuedRebaseResult.Status);
@@ -146,7 +146,7 @@ public void CanQueryRebaseOperation()
146146
Branch upstream = repo.Branches[conflictBranch1Name];
147147
Branch onto = repo.Branches[conflictBranch1Name];
148148

149-
RebaseResult rebaseResult = repo.RebaseOperation.Start(branch, upstream, onto, Constants.Signature, null);
149+
RebaseResult rebaseResult = repo.Rebase.Start(branch, upstream, onto, Constants.Signature, null);
150150

151151
// Verify that we have a conflict.
152152
Assert.Equal(RebaseStatus.Conflicts, rebaseResult.Status);
@@ -155,7 +155,7 @@ public void CanQueryRebaseOperation()
155155
Assert.Equal(0, rebaseRes 10000 ult.CompletedStepCount);
156156
Assert.Equal(3, rebaseResult.TotalStepCount);
157157

158-
RebaseStepInfo info = repo.RebaseOperation.GetCurrentStepInfo();
158+
RebaseStepInfo info = repo.Rebase.GetCurrentStepInfo();
159159
Assert.Equal(0, info.StepIndex);
160160
Assert.Equal(3, info.TotalStepCount);
161161
Assert.Equal(RebaseStepOperation.Pick, info.Type);
@@ -178,7 +178,7 @@ public void CanAbortRebase()
178178
Branch upstream = repo.Branches[conflictBranch1Name];
179179
Branch onto = repo.Branches[conflictBranch1Name];
180180

181-
RebaseResult rebaseResult = repo.RebaseOperation.Start(branch, upstream, onto, Constants.Signature, null);
181+
RebaseResult rebaseResult = repo.Rebase.Start(branch, upstream, onto, Constants.Signature, null);
182182

183183
// Verify that we have a conflict.
184184
Assert.Equal(RebaseStatus.Conflicts, rebaseResult.Status);
@@ -187,7 +187,7 @@ public void CanAbortRebase()
187187
Assert.Equal(0, rebaseResult.CompletedStepCount);
188188
Assert.Equal(3, rebaseResult.TotalStepCount);
189189

190-
repo.RebaseOperation.Abort(Constants.Signature);
190+
repo.Rebase.Abort(Constants.Signature);
191191
Assert.False(repo.RetrieveStatus().IsDirty);
192192
Assert.True(repo.Index.IsFullyMerged);
193193
Assert.Equal(CurrentOperation.None, repo.Info.CurrentOperation);
@@ -210,18 +210,37 @@ public void RebaseWhileAlreadyRebasingThrows()
210210
Branch upstream = repo.Branches[conflictBranch1Name];
211211
Branch onto = repo.Branches[conflictBranch1Name];
212212

213-
RebaseResult rebaseResult = repo.RebaseOperation.Start(branch, upstream, onto, Constants.Signature, null);
213+
RebaseResult rebaseResult = repo.Rebase.Start(branch, upstream, onto, Constants.Signature, null);
214214

215215
// Verify that we have a conflict.
216216
Assert.Equal(RebaseStatus.Conflicts, rebaseResult.Status);
217217
Assert.True(repo.RetrieveStatus().IsDirty);
218218
Assert.Equal(CurrentOperation.RebaseMerge, repo.Info.CurrentOperation);
219219

220220
Assert.Throws<LibGit2SharpException>(() =>
221-
repo.RebaseOperation.Start(branch, upstream, onto, Constants.Signature, null));
221+
repo.Rebase.Start(branch, upstream, onto, Constants.Signature, null));
222222
}
223223
}
224224

225+
[Fact]
226+
public void RebaseOperationsWithoutRebasingThrow()
227+
{
228+
SelfCleaningDirectory scd = BuildSelfCleaningDirectory();
229+
var path = Repository.Init(scd.DirectoryPath);
230+
using (Repository repo = new Repository(path))
231+
{
232+
ConstructRebaseTestRepository(repo);
233+
234+
repo.Checkout(topicBranch1Name);
235+
236+
Assert.Throws<NotFoundException>(() =>
237+
repo.Rebase.Continue(Constants.Signature, new RebaseOptions()));
238+
239+
Assert.Throws<NotFoundException>(() =>
240+
repo.Rebase.Abort(Constants.Signature));
241+
}
242+
}
243+
225244
[Fact]
226245
public void CurrentStepInfoIsNullWhenNotRebasing()
227246
{
@@ -232,7 +251,7 @@ public void CurrentStepInfoIsNullWhenNotRebasing()
232251
ConstructRebaseTestRepository(repo);
233252
repo.Checkout(topicBranch1Name);
234253

235-
Assert.Null(repo.RebaseOperation.GetCurrentStepInfo());
254+
Assert.Null(repo.Rebase.GetCurrentStepInfo());
236255
}
237256
}
238257

LibGit2Sharp/IRepository.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,7 @@ public interface IRepository : IDisposable
226226
/// <summary>
227227
/// Access to Rebase functionality.
228228
/// </summary>
229-
Rebase RebaseOperation { get; }
229+
Rebase Rebase { get; }
230230

231231
/// <summary>
232232
/// Merge the reference that was recently fetched. This will merge

LibGit2Sharp/Repository.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -260,9 +260,9 @@ public Network Network
260260
}
261261

262262
/// <summary>
263-
/// Provides access to network functionality for a repository.
263+
/// Provides access to rebase functionality for a repository.
264264
/// </summary>
265-
public Rebase RebaseOperation
265+
public Rebase Rebase
266266
{
267267
get
268268
{

0 commit comments

Comments
 (0)
0