Skip to content

FileStatus names #527

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 27, 2015
Merged
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
26 changes: 13 additions & 13 deletions LibGit2Sharp.Tests/CheckoutFixture.cs
Original file line number Diff line number Diff line change
Expand Up @@ -527,13 +527,13 @@ public void CheckoutRetainsUntrackedChanges()

// Verify that there is an untracked entry.
Assert.Equal(1, repo.RetrieveStatus().Untracked.Count());
Assert.Equal(FileStatus.Untracked, repo.RetrieveStatus(fullPathFileB));
Assert.Equal(FileStatus.NewInWorkdir, repo.RetrieveStatus(fullPathFileB));

repo.Checkout(otherBranchName);

// Verify untracked entry still exists.
Assert.Equal(1, repo.RetrieveStatus().Untracked.Count());
Assert.Equal(FileStatus.Untracked, repo.RetrieveStatus(fullPathFileB));
Assert.Equal(FileStatus.NewInWorkdir, repo.RetrieveStatus(fullPathFileB));
}
}

Expand All @@ -551,13 +551,13 @@ public void ForceCheckoutRetainsUntrackedChanges()

// Verify that there is an untracked entry.
Assert.Equal(1, repo.RetrieveStatus().Untracked.Count());
Assert.Equal(FileStatus.Untracked, repo.RetrieveStatus(fullPathFileB));
Assert.Equal(FileStatus.NewInWorkdir, repo.RetrieveStatus(fullPathFileB));

repo.Checkout(otherBranchName, new CheckoutOptions() { CheckoutModifiers = CheckoutModifiers.Force });

// Verify untracked entry still exists.
Assert.Equal(1, repo.RetrieveStatus().Untracked.Count());
Assert.Equal(FileStatus.Untracked, repo.RetrieveStatus(fullPathFileB));
Assert.Equal(FileStatus.NewInWorkdir, repo.RetrieveStatus(fullPathFileB));
}
}

Expand All @@ -575,13 +575,13 @@ public void CheckoutRetainsUnstagedChanges()

// Verify that there is a modified entry.
Assert.Equal(1, repo.RetrieveStatus().Modified.Count());
Assert.Equal(FileStatus.Modified, repo.RetrieveStatus(fullPathFileA));
Assert.Equal(FileStatus.ModifiedInWorkdir, repo.RetrieveStatus(fullPathFileA));

repo.Checkout(otherBranchName);

// Verify modified entry still exists.
Assert.Equal(1, repo.RetrieveStatus().Modified.Count());
Assert.Equal(FileStatus.Modified, repo.RetrieveStatus(fullPathFileA));
Assert.Equal(FileStatus.ModifiedInWorkdir, repo.RetrieveStatus(fullPathFileA));
}
}

Expand All @@ -600,13 +600,13 @@ public void CheckoutRetainsStagedChanges()

// Verify that there is a staged entry.
Assert.Equal(1, repo.RetrieveStatus().Staged.Count());
Assert.Equal(FileStatus.Staged, repo.RetrieveStatus(fullPathFileA));
Assert.Equal(FileStatus.ModifiedInIndex, repo.RetrieveStatus(fullPathFileA));

repo.Checkout(otherBranchName);

// Verify staged entry still exists.
Assert.Equal(1, repo.RetrieveStatus().Staged.Count());
Assert.Equal(FileStatus.Staged, repo.RetrieveStatus(fullPathFileA));
Assert.Equal(FileStatus.ModifiedInIndex, repo.RetrieveStatus(fullPathFileA));
}
}

Expand Down Expand Up @@ -935,10 +935,10 @@ public void CanCheckoutDetachedHead()
}

[Theory]
[InlineData("master", "6dcf9bf", "readme.txt", FileStatus.Added)]
[InlineData("master", "refs/tags/lw", "readme.txt", FileStatus.Added)]
[InlineData("master", "i-do-numbers", "super-file.txt", FileStatus.Added)]
[InlineData("i-do-numbers", "diff-test-cases", "numbers.txt", FileStatus.Staged)]
[InlineData("master", "6dcf9bf", "readme.txt", FileStatus.NewInIndex)]
[InlineData("master", "refs/tags/lw", "readme.txt", FileStatus.NewInIndex)]
[InlineData("master", "i-do-numbers", "super-file.txt", FileStatus.NewInIndex)]
[InlineData("i-do-numbers", "diff-test-cases", "numbers.txt", FileStatus.ModifiedInIndex)]
public void CanCheckoutPath(string originalBranch, string checkoutFrom, string path, FileStatus expectedStatus)
{
string repoPath = SandboxStandardTestRepo();
Expand Down Expand Up @@ -973,7 +973,7 @@ public void CanCheckoutPaths()

foreach (string checkoutPath in checkoutPaths)
{
Assert.Equal(FileStatus.Added, repo.RetrieveStatus(checkoutPath));
Assert.Equal(FileStatus.NewInIndex, repo.RetrieveStatus(checkoutPath));
}
}
}
Expand Down
24 changes: 12 additions & 12 deletions LibGit2Sharp.Tests/ConflictFixture.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,22 +47,22 @@ private static List<object[]> RenameConflictData
}

[Theory]
[InlineData(true, "ancestor-and-ours.txt", true, false, FileStatus.Removed, 2)]
[InlineData(false, "ancestor-and-ours.txt", true, true, FileStatus.Removed |FileStatus.Untracked, 2)]
[InlineData(true, "ancestor-and-ours.txt", true, false, FileStatus.DeletedFromIndex, 2)]
[InlineData(false, "ancestor-and-ours.txt", true, true, FileStatus.DeletedFromIndex |FileStatus.NewInWorkdir, 2)]
[InlineData(true, "ancestor-and-theirs.txt", true, false, FileStatus.Nonexistent, 2)]
[InlineData(false, "ancestor-and-theirs.txt", true, true, FileStatus.Untracked, 2)]
[InlineData(false, "ancestor-and-theirs.txt", true, true, FileStatus.NewInWorkdir, 2)]
[InlineData(true, "ancestor-only.txt", false, false, FileStatus.Nonexistent, 1)]
[InlineData(false, "ancestor-only.txt", false, false, FileStatus.Nonexistent, 1)]
[InlineData(true, "conflicts-one.txt", true, false, FileStatus.Removed, 3)]
[InlineData(false, "conflicts-one.txt", true, true, FileStatus.Removed | FileStatus.Untracked, 3)]
[InlineData(true, "conflicts-two.txt", true, false, FileStatus.Removed, 3)]
[InlineData(false, "conflicts-two.txt", true, true, FileStatus.Removed | FileStatus.Untracked, 3)]
[InlineData(true, "ours-and-theirs.txt", true, false, FileStatus.Removed, 2)]
[InlineData(false, "ours-and-theirs.txt", true, true, FileStatus.Removed | FileStatus.Untracked, 2)]
[InlineData(true, "ours-only.txt", true, false, FileStatus.Removed, 1)]
[InlineData(false, "ours-only.txt", true, true, FileStatus.Removed | FileStatus.Untracked, 1)]
[InlineData(true, "conflicts-one.txt", true, false, FileStatus.DeletedFromIndex, 3)]
[InlineData(false, "conflicts-one.txt", true, true, FileStatus.DeletedFromIndex | FileStatus.NewInWorkdir, 3)]
[InlineData(true, "conflicts-two.txt", true, false, FileStatus.DeletedFromIndex, 3)]
[InlineData(false, "conflicts-two.txt", true, true, FileStatus.DeletedFromIndex | FileStatus.NewInWorkdir, 3)]
[InlineData(true, "ours-and-theirs.txt", true, false, FileStatus.DeletedFromIndex, 2)]
[InlineData(false, "ours-and-theirs.txt", true, true, FileStatus.DeletedFromIndex | FileStatus.NewInWorkdir, 2)]
[InlineData(true, "ours-only.txt", true, false, FileStatus.DeletedFromIndex, 1)]
[InlineData(false, "ours-only.txt", true, true, FileStatus.DeletedFromIndex | FileStatus.NewInWorkdir, 1)]
[InlineData(true, "theirs-only.txt", true, false, FileStatus.Nonexistent, 1)]
[InlineData(false, "theirs-only.txt", true, true, FileStatus.Untracked, 1)]
[InlineData(false, "theirs-only.txt", true, true, FileStatus.NewInWorkdir, 1)]
public void CanResolveConflictsByRemovingFromTheIndex(
bool removeFromWorkdir, string filename, bool existsBeforeRemove, bool existsAfterRemove, FileStatus lastStatus, int removedIndexEntries)
{
Expand Down
2 changes: 1 addition & 1 deletion LibGit2Sharp.Tests/DiffTreeToTargetFixture.cs
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ public void ShowcaseTheDifferenceBetweenTheTwoKindOfComparison()
File.Move(fullpath + ".bak", fullpath);

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

var wrkDirToIdxToTree = repo.Diff.Compare<TreeChanges>(repo.Head.Tip.Tree,
DiffTargets.Index | DiffTargets.WorkingDirectory);
Expand Down
6 changes: 3 additions & 3 deletions LibGit2Sharp.Tests/DiffWorkdirToIndexFixture.cs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public void CanCompareTheWorkDirAgainstTheIndex()
}

[Theory]
[InlineData("new_untracked_file.txt", FileStatus.Untracked)]
[InlineData("new_untracked_file.txt", FileStatus.NewInWorkdir)]
[InlineData("really-i-cant-exist.txt", FileStatus.Nonexistent)]
public void CanCompareTheWorkDirAgainstTheIndexWithLaxUnmatchedExplicitPathsValidation(string relativePath, FileStatus currentStatus)
{
Expand All @@ -60,7 +60,7 @@ public void CanCompareTheWorkDirAgainstTheIndexWithLaxUnmatchedExplicitPathsVali
}

[Theory]
[InlineData("new_untracked_file.txt", FileStatus.Untracked)]
[InlineData("new_untracked_file.txt", FileStatus.NewInWorkdir)]
[InlineData("really-i-cant-exist.txt", FileStatus.Nonexistent)]
public void ComparingTheWorkDirAgainstTheIndexWithStrictUnmatchedExplicitPathsValidationAndANonExistentPathspecThrows(string relativePath, FileStatus currentStatus)
{
Expand All @@ -74,7 +74,7 @@ public void ComparingTheWorkDirAgainstTheIndexWithStrictUnmatchedExplicitPathsVa
}

[Theory]
[InlineData("new_untracked_file.txt", FileStatus.Untracked)]
[InlineData("new_untracked_file.txt", FileStatus.NewInWorkdir)]
[InlineData("where-am-I.txt", FileStatus.Nonexistent)]
public void CallbackForUnmatchedExplicitPathsIsCalledWhenSet(string relativePath, FileStatus currentStatus)
{
Expand Down
Loading