Skip to content

Commit 303b4c6

Browse files
committed
worktree: change test to invalidate worktree via filesystem
1 parent 6405ce2 commit 303b4c6

File tree

2 files changed

+2
-4
lines changed

2 files changed

+2
-4
lines changed

tests/worktree/worktree.c

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -616,11 +616,8 @@ void test_worktree_worktree__validate_invalid_worktreedir(void)
616616
git_worktree *wt;
617617

618618
cl_git_pass(git_worktree_lookup(&wt, fixture.repo, "testrepo-worktree"));
619-
git__free(wt->worktree_path);
620-
wt->worktree_path = "/path/to/invalid/worktreedir";
621-
619+
p_rename("testrepo-worktree", "testrepo-worktree-tmp");
622620
cl_git_fail(git_worktree_validate(wt));
623621

624-
wt->worktree_path = NULL;
625622
git_worktree_free(wt);
626623
}

tests/worktree/worktree_helpers.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ void cleanup_fixture_worktree(worktree_fixture *fixture)
1919
cl_fixture_cleanup(fixture->reponame);
2020
if (fixture->worktreename)
2121
cl_fixture_cleanup(fixture->worktreename);
22+
p_rename("testrepo-worktree-tmp", "testrepo-worktree");
2223
}
2324

2425
void setup_fixture_worktree(worktree_fixture *fixture)

0 commit comments

Comments
 (0)