summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEdward Thomson <ethomson@edwardthomson.com>2015-09-16 04:12:47 +0000
committerCarlos Martín Nieto <cmn@dwim.me>2015-11-04 16:59:08 -0800
commitd73bf24366615f5a02bd95c4ad0e5c566991e490 (patch)
tree3aa244f7dced90f997788a662c6699f9b5150199
parent9ae94bcc1c9cd48432ba69e64d03dc2d2d025875 (diff)
downloadlibgit2-d73bf24366615f5a02bd95c4ad0e5c566991e490.tar.gz
checkout::tree tests: don't use static buffer
-rw-r--r--tests/checkout/tree.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/tests/checkout/tree.c b/tests/checkout/tree.c
index 9217c12d9..3b84f43ce 100644
--- a/tests/checkout/tree.c
+++ b/tests/checkout/tree.c
@@ -989,15 +989,18 @@ void test_checkout_tree__filemode_preserved_in_index(void)
mode_t read_filemode(const char *path)
{
+ git_buf fullpath = GIT_BUF_INIT;
struct stat st;
- char pathabs[256] = {0};
+ mode_t result;
- strcat(pathabs, clar_sandbox_path());
- strcat(pathabs, "/testrepo/");
- strcat(pathabs, path);
- cl_must_pass(p_stat(pathabs, &st));
+ git_buf_joinpath(&fullpath, "testrepo", path);
+ cl_must_pass(p_stat(fullpath.ptr, &st));
- return st.st_mode;
+ result = GIT_PERMS_IS_EXEC(st.st_mode) ? 0100755 : 0100644;
+
+ git_buf_free(&fullpath);
+
+ return result;
}
void test_checkout_tree__filemode_preserved_in_workdir(void)