worktree: change test to invalidate worktree via filesystem
diff --git a/tests/worktree/worktree.c b/tests/worktree/worktree.c
index c3abf00..88bcaa9 100644
--- a/tests/worktree/worktree.c
+++ b/tests/worktree/worktree.c
@@ -616,11 +616,8 @@ void test_worktree_worktree__validate_invalid_worktreedir(void)
git_worktree *wt;
cl_git_pass(git_worktree_lookup(&wt, fixture.repo, "testrepo-worktree"));
- git__free(wt->worktree_path);
- wt->worktree_path = "/path/to/invalid/worktreedir";
-
+ p_rename("testrepo-worktree", "testrepo-worktree-tmp");
cl_git_fail(git_worktree_validate(wt));
- wt->worktree_path = NULL;
git_worktree_free(wt);
}
diff --git a/tests/worktree/worktree_helpers.c b/tests/worktree/worktree_helpers.c
index 6d4cdba..8d78e16 100644
--- a/tests/worktree/worktree_helpers.c
+++ b/tests/worktree/worktree_helpers.c
@@ -19,6 +19,7 @@ void cleanup_fixture_worktree(worktree_fixture *fixture)
cl_fixture_cleanup(fixture->reponame);
if (fixture->worktreename)
cl_fixture_cleanup(fixture->worktreename);
+ p_rename("testrepo-worktree-tmp", "testrepo-worktree");
}
void setup_fixture_worktree(worktree_fixture *fixture)