Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 9 additions & 5 deletions LibGit2Sharp.Tests/LibGit2Sharp.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,16 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Moq" Version="4.7.99" />
<PackageReference Include="xunit" Version="2.2.0" />
<PackageReference Include="Moq" Version="4.7.145" />
<PackageReference Include="xunit" Version="2.3.1" />
<PackageReference Include="xunit.skippablefact" Version="1.3.3" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.2.0" />
<PackageReference Include="xunit.runner.console" Version="2.2.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.3.0" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.3.1" />
<PackageReference Include="xunit.runner.console" Version="2.3.1" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.5.0" />
</ItemGroup>

<ItemGroup>
<PackageReference Update="Nerdbank.GitVersioning" Version="2.0.41" />
</ItemGroup>

</Project>
48 changes: 24 additions & 24 deletions LibGit2Sharp.Tests/RebaseFixture.cs
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ public void CanRebase(string initialBranchName,
},
};

RebaseResult rebaseResult = repo.Rebase.Start(branch, upstream, onto, Constants.Identity, options);
RebaseResult rebaseResult = Commands.Rebase.Start(repo, branch, upstream, onto, Constants.Identity, options);

// Validation:
Assert.True(afterRebaseStepCountCorrect, "Unexpected CompletedStepIndex value in RebaseStepCompleted");
Expand Down Expand Up @@ -130,7 +130,7 @@ public void CanRebaseBranchOntoItself()
Commands.Checkout(repo, topicBranch2Name);
Branch b = repo.Branches[topicBranch2Name];

RebaseResult result = repo.Rebase.Start(b, b, null, Constants.Identity, new RebaseOptions());
RebaseResult result = Commands.Rebase.Start(repo, b, b, null, Constants.Identity, new RebaseOptions());
Assert.Equal(0, result.TotalStepCount);
Assert.Equal(RebaseStatus.Complete, result.Status);
Assert.Equal(0, result.CompletedStepCount);
Expand Down Expand Up @@ -251,7 +251,7 @@ public void VerifyRebaseDetailed(string attributes, string lineEnding, string[]

};

repo.Rebase.Start(null, upstreamBranch, null, Constants.Identity2, options);
Commands.Rebase.Start(repo, null, upstreamBranch, null, Constants.Identity2, options);

Assert.Equal(true, wasCheckoutNotifyCalledForResetingHead);
Assert.Equal(true, wasCheckoutProgressCalledForResetingHead);
Expand Down Expand Up @@ -317,7 +317,7 @@ public void CanContinueRebase()
CheckoutNotifyFlags = CheckoutNotifyFlags.Updated,
};

RebaseResult rebaseResult = repo.Rebase.Start(branch, upstream, onto, Constants.Identity, options);
RebaseResult rebaseResult = Commands.Rebase.Start(repo, branch, upstream, onto, Constants.Identity, options);

// Verify that we have a conflict.
Assert.Equal(CurrentOperation.RebaseMerge, repo.Info.CurrentOperation);
Expand Down Expand Up @@ -345,7 +345,7 @@ public void CanContinueRebase()

// Clear the flags:
wasCheckoutProgressCalled = false; wasCheckoutNotifyCalled = false;
RebaseResult continuedRebaseResult = repo.Rebase.Continue(Constants.Identity, options);
RebaseResult continuedRebaseResult = Commands.Rebase.Continue(repo, Constants.Identity, options);

Assert.NotNull(continuedRebaseResult);
Assert.Equal(RebaseStatus.Complete, continuedRebaseResult.Status);
Expand Down Expand Up @@ -377,7 +377,7 @@ public void ContinuingRebaseWithUnstagedChangesThrows()
Branch upstream = repo.Branches[conflictBranch1Name];
Branch onto = repo.Branches[conflictBranch1Name];

RebaseResult rebaseResult = repo.Rebase.Start(branch, upstream, onto, Constants.Identity, null);
RebaseResult rebaseResult = Commands.Rebase.Start(repo, branch, upstream, onto, Constants.Identity, null);

// Verify that we have a conflict.
Assert.Equal(CurrentOperation.RebaseMerge, repo.Info.CurrentOperation);
Expand All @@ -388,7 +388,7 @@ public void ContinuingRebaseWithUnstagedChangesThrows()
Assert.Equal(3, rebaseResult.TotalStepCount);

Assert.Throws<UnmergedIndexEntriesException>(() =>
repo.Rebase.Continue(Constants.Identity, null));
Commands.Rebase.Continue(repo, Constants.Identity, null));

// Resolve the conflict
foreach (Conflict conflict in repo.Index.Conflicts)
Expand All @@ -404,7 +404,7 @@ public void ContinuingRebaseWithUnstagedChangesThrows()
"Unstaged content");

Assert.Throws<UnmergedIndexEntriesException>(() =>
repo.Rebase.Continue(Constants.Identity, null));
Commands.Rebase.Continue(repo, Constants.Identity, null));

Assert.True(repo.Index.IsFullyMerged);
}
Expand All @@ -431,7 +431,7 @@ public void CanSpecifyFileConflictStrategy()
FileConflictStrategy = CheckoutFileConflictStrategy.Ours,
};

RebaseResult rebaseResult = repo.Rebase.Start(branch, upstream, onto, Constants.Identity, options);
RebaseResult rebaseResult = Commands.Rebase.Start(repo, branch, upstream, onto, Constants.Identity, options);

// Verify that we have a conflict.
Assert.Equal(CurrentOperation.RebaseMerge, repo.Info.CurrentOperation);
Expand Down Expand Up @@ -473,7 +473,7 @@ public void CanQueryRebaseOperation()
Branch upstream = repo.Branches[conflictBranch1Name];
Branch onto = repo.Branches[conflictBranch1Name];

RebaseResult rebaseResult = repo.Rebase.Start(branch, upstream, onto, Constants.Identity, null);
RebaseResult rebaseResult = Commands.Rebase.Start(repo, branch, upstream, onto, Constants.Identity, null);

// Verify that we have a conflict.
Assert.Equal(RebaseStatus.Conflicts, rebaseResult.Status);
Expand All @@ -482,10 +482,10 @@ public void CanQueryRebaseOperation()
Assert.Equal(0, rebaseResult.CompletedStepCount);
Assert.Equal(3, rebaseResult.TotalStepCount);

RebaseStepInfo info = repo.Rebase.GetCurrentStepInfo();
RebaseStepInfo info = Commands.Rebase.GetCurrentStepInfo(repo);

Assert.Equal(0, repo.Rebase.GetCurrentStepIndex());
Assert.Equal(3, repo.Rebase.GetTotalStepCount());
Assert.Equal(0, Commands.Rebase.GetCurrentStepIndex(repo));
Assert.Equal(3, Commands.Rebase.GetTotalStepCount(repo));
Assert.Equal(RebaseStepOperation.Pick, info.Type);
}
}
Expand All @@ -506,7 +506,7 @@ public void CanAbortRebase()
Branch upstream = repo.Branches[conflictBranch1Name];
Branch onto = repo.Branches[conflictBranch1Name];

RebaseResult rebaseResult = repo.Rebase.Start(branch, upstream, onto, Constants.Identity, null);
RebaseResult rebaseResult = Commands.Rebase.Start(repo, branch, upstream, onto, Constants.Identity, null);

// Verify that we have a conflict.
Assert.Equal(RebaseStatus.Conflicts, rebaseResult.Status);
Expand All @@ -526,7 +526,7 @@ public void CanAbortRebase()
CheckoutNotifyFlags = CheckoutNotifyFlags.Updated,
};

repo.Rebase.Abort(options);
Commands.Rebase.Abort(repo, options);
Assert.False(repo.RetrieveStatus().IsDirty, "Repository workdir is dirty after Rebase.Abort.");
Assert.True(repo.Index.IsFullyMerged, "Repository index is not fully merged after Rebase.Abort.");
Assert.Equal(CurrentOperation.None, repo.Info.CurrentOperation);
Expand All @@ -552,15 +552,15 @@ public void RebaseWhileAlreadyRebasingThrows()
Branch upstream = repo.Branches[conflictBranch1Name];
Branch onto = repo.Branches[conflictBranch1Name];

RebaseResult rebaseResult = repo.Rebase.Start(branch, upstream, onto, Constants.Identity, null);
RebaseResult rebaseResult = Commands.Rebase.Start(repo, branch, upstream, onto, Constants.Identity, null);

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

Assert.Throws<LibGit2SharpException>(() =>
repo.Rebase.Start(branch, upstream, onto, Constants.Identity, null));
Commands.Rebase.Start(repo, branch, upstream, onto, Constants.Identity, null));
}
}

Expand All @@ -576,10 +576,10 @@ public void RebaseOperationsWithoutRebasingThrow()
Commands.Checkout(repo, topicBranch1Name);

Assert.Throws<NotFoundException>(() =>
repo.Rebase.Continue(Constants.Identity, new RebaseOptions()));
Commands.Rebase.Continue(repo, Constants.Identity, new RebaseOptions()));

Assert.Throws<NotFoundException>(() =>
repo.Rebase.Abort());
Commands.Rebase.Abort(repo));
}
}

Expand All @@ -593,7 +593,7 @@ public void CurrentStepInfoIsNullWhenNotRebasing()
ConstructRebaseTestRepository(repo);
Commands.Checkout(repo, topicBranch1Name);

Assert.Null(repo.Rebase.GetCurrentStepInfo());
Assert.Null(Commands.Rebase.GetCurrentStepInfo(repo));
}
}

Expand Down Expand Up @@ -642,7 +642,7 @@ public void CanRebaseHandlePatchAlreadyApplied(string attributes, string lineEnd
}
};

repo.Rebase.Start(null, upstreamBranch, null, Constants.Identity2, options);
Commands.Rebase.Start(repo, null, upstreamBranch, null, Constants.Identity2, options);
ObjectId secondCommitExpectedTreeId = new ObjectId(expectedShaText);
Signature secondCommitAuthorSignature = Constants.Signature;
Identity secondCommitCommiterIdentity = Constants.Identity2;
Expand Down Expand Up @@ -670,9 +670,9 @@ public void RebasingInBareRepositoryThrows()
Branch rebaseUpstreamBranch = repo.Branches["refs/heads/test"];

Assert.NotNull(rebaseUpstreamBranch);
Assert.Throws<BareRepositoryException>(() => repo.Rebase.Start(null, rebaseUpstreamBranch, null, Constants.Identity, new RebaseOptions()));
Assert.Throws<BareRepositoryException>(() => repo.Rebase.Continue(Constants.Identity, new RebaseOptions()));
Assert.Throws<BareRepositoryException>(() => repo.Rebase.Abort());
Assert.Throws<BareRepositoryException>(() => Commands.Rebase.Start(repo, null, rebaseUpstreamBranch, null, Constants.Identity, new RebaseOptions()));
Assert.Throws<BareRepositoryException>(() => Commands.Rebase.Continue(repo, Constants.Identity, new RebaseOptions()));
Assert.Throws<BareRepositoryException>(() => Commands.Rebase.Abort(repo));
}
}

Expand Down
6 changes: 3 additions & 3 deletions LibGit2Sharp.Tests/RemoveFixture.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,22 +28,22 @@ public class RemoveFixture : BaseFixture
* 'git rm <file>' fails ("error: '<file>' has local modifications").
*/
[InlineData(false, "modified_unstaged_file.txt", false, FileStatus.ModifiedInWorkdir, true, true, FileStatus.NewInWorkdir | FileStatus.DeletedFromIndex)]
[InlineData(true, "modified_unstaged_file.txt", true, FileStatus.ModifiedInWorkdir, true, true, 0)]
[InlineData(true, "modified_unstaged_file.txt", true, FileStatus.ModifiedInWorkdir, true, true, FileStatus.Unaltered)]
/***
* Test case: modified file in wd, the modifications have already been promoted to the index.
* 'git rm --cached <file>' works (removes the file from the index)
* 'git rm <file>' fails ("error: '<file>' has changes staged in the index")
*/
[InlineData(false, "modified_staged_file.txt", false, FileStatus.ModifiedInIndex, true, true, FileStatus.NewInWorkdir | FileStatus.DeletedFromIndex)]
[InlineData(true, "modified_staged_file.txt", true, FileStatus.ModifiedInIndex, true, true, 0)]
[InlineData(true, "modified_staged_file.txt", true, FileStatus.ModifiedInIndex, true, true, FileStatus.Unaltered)]
/***
* Test case: modified file in wd, the modifications have already been promoted to the index, and
* the file does not exist in the HEAD.
* 'git rm --cached <file>' works (removes the file from the index)
* 'git rm <file>' throws ("error: '<file>' has changes staged in the index")
*/
[InlineData(false, "new_tracked_file.txt", false, FileStatus.NewInIndex, true, true, FileStatus.NewInWorkdir)]
[InlineData(true, "new_tracked_file.txt", true, FileStatus.NewInIndex, true, true, 0)]
[InlineData(true, "new_tracked_file.txt", true, FileStatus.NewInIndex, true, true, FileStatus.Unaltered)]
public void CanRemoveAnUnalteredFileFromTheIndexWithoutRemovingItFromTheWorkingDirectory(
bool removeFromWorkdir, string filename, bool throws, FileStatus initialStatus, bool existsBeforeRemove, bool existsAfterRemove, FileStatus lastStatus)
{
Expand Down
Loading