Skip to content

Commit c3169e6

Browse files
committed
checkout::crlf clear the crlf workdir for checkout
After sandboxing the crlf directory, remove the working directory contents. This allows us to package data within the crlf directory (for simplicity, this allows us to script the to-odb and to-workdir crlf filter conversion data in a single location).
1 parent 13a8bc9 commit c3169e6

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

tests/checkout/crlf.c

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,38 @@ static git_repository *g_repo;
1313
static const char *systype;
1414
static git_buf expected_fixture = GIT_BUF_INIT;
1515

16+
static int unlink_file(void *payload, git_buf *path)
17+
{
18+
const char *fn = git_path_basename(path->ptr);
19+
20+
GIT_UNUSED(payload);
21+
22+
if (strcmp(fn, ".git"))
23+
cl_must_pass(p_unlink(path->ptr));
24+
25+
git__free(fn);
26+
return 0;
27+
}
28+
1629
void test_checkout_crlf__initialize(void)
1730
{
31+
git_buf reponame = GIT_BUF_INIT;
32+
1833
g_repo = cl_git_sandbox_init("crlf");
1934

35+
/*
36+
* remove the contents of the working directory so that we can
37+
* check out over it.
38+
*/
39+
git_buf_puts(&reponame, "crlf");
40+
cl_git_pass(git_path_direach(&reponame, 0, unlink_file, NULL));
41+
2042
if (GIT_EOL_NATIVE == GIT_EOL_CRLF)
2143
systype = "windows";
2244
else
2345
systype = "posix";
46+
47+
git_buf_dispose(&reponame);
2448
}
2549

2650
void test_checkout_crlf__cleanup(void)

0 commit comments

Comments
 (0)