mirror of
https://git.proxmox.com/git/libgit2
synced 2025-05-28 08:58:41 +00:00
Merge pull request #3011 from ethomson/filter_zero_tempbuf
Clear temporary buffer when filtering
This commit is contained in:
commit
de355f2341
@ -809,6 +809,9 @@ static int proxy_stream_init(
|
||||
proxy_stream->target = target;
|
||||
proxy_stream->output = temp_buf ? temp_buf : &proxy_stream->temp_buf;
|
||||
|
||||
if (temp_buf)
|
||||
git_buf_clear(temp_buf);
|
||||
|
||||
*out = (git_writestream *)proxy_stream;
|
||||
return 0;
|
||||
}
|
||||
|
@ -347,3 +347,23 @@ void test_checkout_crlf__autocrlf_input_text_auto_attr(void)
|
||||
check_file_contents("./crlf/all-lf", ALL_LF_TEXT_RAW);
|
||||
check_file_contents("./crlf/all-crlf", ALL_CRLF_TEXT_RAW);
|
||||
}
|
||||
|
||||
void test_checkout_crlf__can_write_empty_file(void)
|
||||
{
|
||||
git_checkout_options opts = GIT_CHECKOUT_OPTIONS_INIT;
|
||||
opts.checkout_strategy = GIT_CHECKOUT_FORCE;
|
||||
|
||||
cl_repo_set_bool(g_repo, "core.autocrlf", true);
|
||||
|
||||
git_repository_set_head(g_repo, "refs/heads/empty-files");
|
||||
git_checkout_head(g_repo, &opts);
|
||||
|
||||
check_file_contents("./crlf/test1.txt", "");
|
||||
|
||||
if (GIT_EOL_NATIVE == GIT_EOL_LF)
|
||||
check_file_contents("./crlf/test2.txt", "test2.txt's content\n");
|
||||
else
|
||||
check_file_contents("./crlf/test2.txt", "test2.txt's content\r\n");
|
||||
|
||||
check_file_contents("./crlf/test3.txt", "");
|
||||
}
|
||||
|
BIN
tests/resources/crlf/.gitted/index
Normal file
BIN
tests/resources/crlf/.gitted/index
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
tests/resources/crlf/.gitted/refs/heads/empty-files
Normal file
BIN
tests/resources/crlf/.gitted/refs/heads/empty-files
Normal file
Binary file not shown.
Loading…
Reference in New Issue
Block a user