summaryrefslogtreecommitdiff
path: root/tests/checkout
diff options
context:
space:
mode:
authorEdward Thomson <ethomson@edwardthomson.com>2018-12-01 19:59:41 +0000
committerEdward Thomson <ethomson@edwardthomson.com>2018-12-03 17:01:24 -0800
commitc3169e6f62960e5c667c77bbaadb396ad6300efd (patch)
tree7195399af6298678b4783b7b4302c0d611eb4b95 /tests/checkout
parent13a8bc924c16865a5409fa34994ec3bb11e1c4b5 (diff)
downloadlibgit2-c3169e6f62960e5c667c77bbaadb396ad6300efd.tar.gz
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).
Diffstat (limited to 'tests/checkout')
-rw-r--r--tests/checkout/crlf.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/tests/checkout/crlf.c b/tests/checkout/crlf.c
index 94fd8a6b4..0ad88b5fe 100644
--- a/tests/checkout/crlf.c
+++ b/tests/checkout/crlf.c
@@ -13,14 +13,38 @@ static git_repository *g_repo;
static const char *systype;
static git_buf expected_fixture = GIT_BUF_INIT;
+static int unlink_file(void *payload, git_buf *path)
+{
+ const char *fn = git_path_basename(path->ptr);
+
+ GIT_UNUSED(payload);
+
+ if (strcmp(fn, ".git"))
+ cl_must_pass(p_unlink(path->ptr));
+
+ git__free(fn);
+ return 0;
+}
+
void test_checkout_crlf__initialize(void)
{
+ git_buf reponame = GIT_BUF_INIT;
+
g_repo = cl_git_sandbox_init("crlf");
+ /*
+ * remove the contents of the working directory so that we can
+ * check out over it.
+ */
+ git_buf_puts(&reponame, "crlf");
+ cl_git_pass(git_path_direach(&reponame, 0, unlink_file, NULL));
+
if (GIT_EOL_NATIVE == GIT_EOL_CRLF)
systype = "windows";
else
systype = "posix";
+
+ git_buf_dispose(&reponame);
}
void test_checkout_crlf__cleanup(void)