summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorRussell Belfer <arrbee@arrbee.com>2011-12-14 12:34:43 -0800
committerRussell Belfer <arrbee@arrbee.com>2011-12-14 14:31:06 -0800
commitb5daae68a4ae859653141fb097e7b7c81b25530b (patch)
tree977115657e8b1690ea0a7d65ba49fc421b4cb392 /tests
parentd6ccedddd2f76d69b05ecfa45a93cde8682776e6 (diff)
downloadlibgit2-b5daae68a4ae859653141fb097e7b7c81b25530b.tar.gz
Allow git_buf_joinpath to accept self-joins
It was not safe for git_buf_joinpath to be used with a pointer into the buf itself because a reallocation could invalidate the input parameter that pointed into the buffer. This patch makes it safe to self join, at least for the leading input to the join, which is the common "append" case for self joins. Also added unit tests to explicitly cover this case. This should actually fix #511
Diffstat (limited to 'tests')
-rw-r--r--tests/test_helpers.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/tests/test_helpers.c b/tests/test_helpers.c
index d4ed10d9..40b3499b 100644
--- a/tests/test_helpers.c
+++ b/tests/test_helpers.c
@@ -236,7 +236,7 @@ static int copy_filesystem_element_recurs(void *_data, git_buf *source)
copydir_data *data = (copydir_data *)_data;
git_buf_truncate(&data->dst, data->dst_baselen);
- git_buf_joinpath(&data->dst, data->dst.ptr, source->ptr + data->src_baselen);
+ git_buf_puts(&data->dst, source->ptr + data->src_baselen);
if (git_futils_isdir(source->ptr) == GIT_SUCCESS)
return git_futils_direach(source, copy_filesystem_element_recurs, _data);