Skip to content
Closed
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
2 changes: 1 addition & 1 deletion LibGit2Sharp.Tests/AttributesFixture.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ private static void AssertNormalization(IRepository repo, string filename, bool

Touch(repo.Info.WorkingDirectory, filename, sb.ToString());

repo.Index.Stage(filename);
repo.Stage(filename);

IndexEntry entry = repo.Index[filename];
Assert.NotNull(entry);
Expand Down
6 changes: 3 additions & 3 deletions LibGit2Sharp.Tests/BlobFixture.cs
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ public void CanGetBlobAsTextWithVariousEncodings(string encodingName, int expect
var bomPath = Touch(repo.Info.WorkingDirectory, bomFile, content, encoding);
Assert.Equal(expectedContentBytes, File.ReadAllBytes(bomPath).Length);

repo.Index.Stage(bomFile);
repo.Stage(bomFile);
var commit = repo.Commit("bom", Constants.Signature, Constants.Signature);

var blob = (Blob)commit.Tree[bomFile].Target;
Expand Down Expand Up @@ -186,7 +186,7 @@ public void CanStageAFileGeneratedFromABlobContentStream()
File.AppendAllText(Path.Combine(repo.Info.WorkingDirectory, "small.txt"), sb.ToString());
}

repo.Index.Stage("small.txt");
repo.Stage("small.txt");
IndexEntry entry = repo.Index["small.txt"];
Assert.Equal("baae1fb3760a73481ced1fa03dc15614142c19ef", entry.Id.Sha);

Expand All @@ -198,7 +198,7 @@ public void CanStageAFileGeneratedFromABlobContentStream()
CopyStream(stream, file);
}

repo.Index.Stage("small.fromblob.txt");
repo.Stage("small.fromblob.txt");
IndexEntry newentry = repo.Index["small.fromblob.txt"];

Assert.Equal("baae1fb3760a73481ced1fa03dc15614142c19ef", newentry.Id.Sha);
Expand Down
2 changes: 1 addition & 1 deletion LibGit2Sharp.Tests/BranchFixture.cs
Original file line number Diff line number Diff line change
Expand Up @@ -966,7 +966,7 @@ public void TrackedBranchExistsFromDefaultConfigInEmptyClone()
Assert.Equal("origin", repo.Head.Remote.Name);

Touch(repo.Info.WorkingDirectory, "a.txt", "a");
repo.Index.Stage("a.txt");
repo.Stage("a.txt");
repo.Commit("A file", Constants.Signature, Constants.Signature);

Assert.NotNull(repo.Head.Tip);
Expand Down
140 changes: 70 additions & 70 deletions LibGit2Sharp.Tests/CheckoutFixture.cs

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions LibGit2Sharp.Tests/CherryPickFixture.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public void CanCherryPick(bool fromDetachedHead)

Assert.Equal(CherryPickStatus.CherryPicked, result.Status);
Assert.Equal(cherryPickedCommitId, result.Commit.Id.Sha);
Assert.False(repo.Index.RetrieveStatus().Any());
Assert.False(repo.RetrieveStatus().Any());
Assert.Equal(fromDetachedHead, repo.Info.IsHeadDetached);
Assert.Equal(commitToMerge.Author, result.Commit.Author);
Assert.Equal(Constants.Signature, result.Commit.Committer);
Expand Down Expand Up @@ -130,7 +130,7 @@ private Commit AddFileCommitToRepo(IRepository repository, string filename, stri
{
Touch(repository.Info.WorkingDirectory, filename, content);

repository.Index.Stage(filename);
repository.Stage(filename);

return repository.Commit("New commit", Constants.Signature, Constants.Signature);
}
Expand Down
8 changes: 4 additions & 4 deletions LibGit2Sharp.Tests/CleanFixture.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,14 @@ public void CanCleanWorkingDirectory()
using (var repo = new Repository(path))
{
// Verify that there are the expected number of entries and untracked files
Assert.Equal(6, repo.Index.RetrieveStatus().Count());
Assert.Equal(1, repo.Index.RetrieveStatus().Untracked.Count());
Assert.Equal(6, repo.RetrieveStatus().Count());
Assert.Equal(1, repo.RetrieveStatus().Untracked.Count());

repo.RemoveUntrackedFiles();

// Verify that there are the expected number of entries and 0 untracked files
Assert.Equal(5, repo.Index.RetrieveStatus().Count());
Assert.Equal(0, repo.Index.RetrieveStatus().Untracked.Count());
Assert.Equal(5, repo.RetrieveStatus().Count());
Assert.Equal(0, repo.RetrieveStatus().Untracked.Count());
}
}

Expand Down
26 changes: 13 additions & 13 deletions LibGit2Sharp.Tests/CommitFixture.cs
Original file line number Diff line number Diff line change
Expand Up @@ -534,10 +534,10 @@ public void CanCommitWithSignatureFromConfig()

const string relativeFilepath = "new.txt";
string filePath = Touch(repo.Info.WorkingDirectory, relativeFilepath, "null");
repo.Index.Stage(relativeFilepath);
repo.Stage(relativeFilepath);

File.AppendAllText(filePath, "token\n");
repo.Index.Stage(relativeFilepath);
repo.Stage(relativeFilepath);

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

Expand Down Expand Up @@ -594,7 +594,7 @@ public void CommitCleansUpMergeMetadata()

const string relativeFilepath = "new.txt";
Touch(repo.Info.WorkingDirectory, relativeFilepath, "this is a new file");
repo.Index.Stage(relativeFilepath);
repo.Stage(relativeFilepath);

string mergeHeadPath = Touch(repo.Info.Path, "MERGE_HEAD", "abcdefabcdefabcdefabcdefabcdefabcdefabcd");
string mergeMsgPath = Touch(repo.Info.Path, "MERGE_MSG", "This is a dummy merge.\n");
Expand Down Expand Up @@ -629,9 +629,9 @@ public void CanCommitALittleBit()

const string relativeFilepath = "new.txt";
string filePath = Touch(repo.Info.WorkingDirectory, relativeFilepath, "null");
repo.Index.Stage(relativeFilepath);
repo.Stage(relativeFilepath);
File.AppendAllText(filePath, "token\n");
repo.Index.Stage(relativeFilepath);
repo.Stage(relativeFilepath);

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

Expand Down Expand Up @@ -662,7 +662,7 @@ public void CanCommitALittleBit()
Assert.Equal(commit.Id, repo.Refs.Log(targetCanonicalName).First().To);

File.WriteAllText(filePath, "nulltoken commits!\n");
repo.Index.Stage(relativeFilepath);
repo.Stage(relativeFilepath);

var author2 = new Signature(author.Name, author.Email, author.When.AddSeconds(5));
Commit commit2 = repo.Commit("Are you trying to fork me?", author2, author2);
Expand All @@ -683,7 +683,7 @@ public void CanCommitALittleBit()
File.WriteAllText(filePath, "davidfowl commits!\n");

var author3 = new Signature("David Fowler", "david.fowler@microsoft.com", author.When.AddSeconds(2));
repo.Index.Stage(relativeFilepath);
repo.Stage(relativeFilepath);

Commit commit3 = repo.Commit("I'm going to branch you backwards in time!", author3, author3);

Expand All @@ -709,7 +709,7 @@ private static void AddCommitToRepo(string path)
{
const string relativeFilepath = "test.txt";
Touch(repo.Info.WorkingDirectory, relativeFilepath, "test\n");
repo.Index.Stage(relativeFilepath);
repo.Stage(relativeFilepath);

var author = new Signature("nulltoken", "emeric.fermas@gmail.com", DateTimeOffset.Parse("Wed, Dec 14 2011 08:29:03 +0100"));
repo.Commit("Initial commit", author, author);
Expand Down Expand Up @@ -793,7 +793,7 @@ private static void CreateAndStageANewFile(IRepository repo)
{
string relativeFilepath = string.Format("new-file-{0}.txt", Guid.NewGuid());
Touch(repo.Info.WorkingDirectory, relativeFilepath, "brand new content\n");
repo.Index.Stage(relativeFilepath);
repo.Stage(relativeFilepath);
}

private static void AssertCommitHasBeenAmended(IRepository repo, Commit amendedCommit, Commit originalCommit)
Expand Down Expand Up @@ -882,7 +882,7 @@ public void CanCommitOnOrphanedBranch()

const string relativeFilepath = "test.txt";
Touch(repo.Info.WorkingDirectory, relativeFilepath, "test\n");
repo.Index.Stage(relativeFilepath);
repo.Stage(relativeFilepath);

repo.Commit("Initial commit", Constants.Signature, Constants.Signature);
Assert.Equal(1, repo.Head.Commits.Count());
Expand Down Expand Up @@ -998,16 +998,16 @@ public void CanNotAmendACommitInAWayThatWouldLeadTheNewCommitToBecomeEmpty()
using (var repo = new Repository(repoPath))
{
Touch(repo.Info.WorkingDirectory, "test.txt", "test\n");
repo.Index.Stage("test.txt");
repo.Stage("test.txt");

repo.Commit("Initial commit", Constants.Signature, Constants.Signature);

Touch(repo.Info.WorkingDirectory, "new.txt", "content\n");
repo.Index.Stage("new.txt");
repo.Stage("new.txt");

repo.Commit("One commit", Constants.Signature, Constants.Signature);

repo.Index.Remove("new.txt");
repo.Remove("new.txt");

Assert.Throws<EmptyCommitException>(() => repo.Commit("Oops", Constants.Signature, Constants.Signature,
new CommitOptions { AmendPreviousCommit = true }));
Expand Down
4 changes: 2 additions & 2 deletions LibGit2Sharp.Tests/ConflictFixture.cs
Original file line number Diff line number Diff line change
Expand Up @@ -77,12 +77,12 @@ public void CanResolveConflictsByRemovingFromTheIndex(
Assert.NotNull(repo.Index.Conflicts[filename]);
Assert.Equal(0, repo.Index.Conflicts.ResolvedConflicts.Count());

repo.Index.Remove(filename, removeFromWorkdir);
repo.Remove(filename, removeFromWorkdir);

Assert.Null(repo.Index.Conflicts[filename]);
Assert.Equal(count - removedIndexEntries, repo.Index.Count);
Assert.Equal(existsAfterRemove, File.Exists(fullpath));
Assert.Equal(lastStatus, repo.Index.RetrieveStatus(filename));
Assert.Equal(lastStatus, repo.RetrieveStatus(filename));

Assert.Equal(1, repo.Index.Conflicts.ResolvedConflicts.Count());
Assert.NotNull(repo.Index.Conflicts.ResolvedConflicts[filename]);
Expand Down
12 changes: 6 additions & 6 deletions LibGit2Sharp.Tests/DiffTreeToTargetFixture.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@ private static void SetUpSimpleDiffContext(IRepository repo)
{
var fullpath = Touch(repo.Info.WorkingDirectory, "file.txt", "hello\n");

repo.Index.Stage(fullpath);
repo.Stage(fullpath);
repo.Commit("Initial commit", Constants.Signature, Constants.Signature);

File.AppendAllText(fullpath, "world\n");

repo.Index.Stage(fullpath);
repo.Stage(fullpath);

File.AppendAllText(fullpath, "!!!\n");
}
Expand Down Expand Up @@ -158,10 +158,10 @@ public void ShowcaseTheDifferenceBetweenTheTwoKindOfComparison()

var fullpath = Path.Combine(repo.Info.WorkingDirectory, "file.txt");
File.Move(fullpath, fullpath + ".bak");
repo.Index.Stage(fullpath);
repo.Stage(fullpath);
File.Move(fullpath + ".bak", fullpath);

FileStatus state = repo.Index.RetrieveStatus("file.txt");
FileStatus state = repo.RetrieveStatus("file.txt");
Assert.Equal(FileStatus.Removed | FileStatus.Untracked, state);

var wrkDirToIdxToTree = repo.Diff.Compare<TreeChanges>(repo.Head.Tip.Tree,
Expand Down Expand Up @@ -373,11 +373,11 @@ public void CanCopeWithEndOfFileNewlineChanges()
{
var fullpath = Touch(repo.Info.WorkingDirectory, "file.txt", "a");

repo.Index.Stage("file.txt");
repo.Stage("file.txt");
repo.Commit("Add file without line ending", Constants.Signature, Constants.Signature);

File.AppendAllText(fullpath, "\n");
repo.Index.Stage("file.txt");
repo.Stage("file.txt");

var changes = repo.Diff.Compare<TreeChanges>(repo.Head.Tip.Tree, DiffTargets.Index);
Assert.Equal(1, changes.Modified.Count());
Expand Down
Loading