Skip to content

Commit 72e3629

Browse files
committed
Test that we only checkout requested files
1 parent 7ae4d9a commit 72e3629

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

tests/testthat/test-restore.R

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,15 +20,19 @@ test_that("git_restore restores from a specific ref", {
2020
configure_local_user(repo)
2121

2222
writeLines("v1", file.path(repo, "hello.txt"))
23-
git_add("hello.txt", repo = repo)
23+
writeLines("v1", file.path(repo, "keep.txt"))
24+
25+
git_add(c("hello.txt", "keep.txt"), repo = repo)
2426
first <- git_commit("First commit", repo = repo)
2527

2628
writeLines("v2", file.path(repo, "hello.txt"))
27-
git_add("hello.txt", repo = repo)
29+
writeLines("v2", file.path(repo, "keep.txt"))
30+
git_add(c("hello.txt", "keep.txt"), repo = repo)
2831
git_commit("Second commit", repo = repo)
2932

3033
git_restore("hello.txt", ref = first, repo = repo)
3134
expect_equal(readLines(file.path(repo, "hello.txt")), "v1")
35+
expect_equal(readLines(file.path(repo, "keep.txt")), "v2")
3236
})
3337

3438
test_that("git_restore restores all files with path = '.'", {

0 commit comments

Comments
 (0)