From 7c2b9e063b23f804ee056db177cd1b5e66832ccd Mon Sep 17 00:00:00 2001 From: Jacques Germishuys Date: Sun, 22 Mar 2015 19:06:53 +0200 Subject: [PATCH] Illustrate bad checkout on Windows --- tests/checkout/crlf.c | 20 ++++++++++++++++++ tests/resources/crlf/.gitted/index | Bin 0 -> 425 bytes .../16/c72b67861f8524a5bebc05cd20472d3fca00da | Bin 0 -> 64 bytes .../3f/96bdca0e37616026afaa325c148cec4aa62d04 | Bin 0 -> 164 bytes .../47/fbc2c28a18df0dc773276a253eb85c7516ca50 | Bin 0 -> 36 bytes .../4b/825dc642cb6eb9a060e54bf8d69288fbee4904 | Bin 0 -> 15 bytes .../6a/e3e9c11a51f0aabebcffcbd5c00f4beed143c9 | Bin 0 -> 87 bytes .../96/87e444bcbb85645cb496080434c292f1b57182 | Bin 0 -> 178 bytes .../97/449da2d225557c558ac244384d487e66c3e591 | Bin 0 -> 177 bytes .../crlf/.gitted/refs/heads/empty-files | Bin 0 -> 41 bytes 10 files changed, 20 insertions(+) create mode 100644 tests/resources/crlf/.gitted/index create mode 100644 tests/resources/crlf/.gitted/objects/16/c72b67861f8524a5bebc05cd20472d3fca00da create mode 100644 tests/resources/crlf/.gitted/objects/3f/96bdca0e37616026afaa325c148cec4aa62d04 create mode 100644 tests/resources/crlf/.gitted/objects/47/fbc2c28a18df0dc773276a253eb85c7516ca50 create mode 100644 tests/resources/crlf/.gitted/objects/4b/825dc642cb6eb9a060e54bf8d69288fbee4904 create mode 100644 tests/resources/crlf/.gitted/objects/6a/e3e9c11a51f0aabebcffcbd5c00f4beed143c9 create mode 100644 tests/resources/crlf/.gitted/objects/96/87e444bcbb85645cb496080434c292f1b57182 create mode 100644 tests/resources/crlf/.gitted/objects/97/449da2d225557c558ac244384d487e66c3e591 create mode 100644 tests/resources/crlf/.gitted/refs/heads/empty-files diff --git a/tests/checkout/crlf.c b/tests/checkout/crlf.c index a7a579eaa..a9acdf406 100644 --- a/tests/checkout/crlf.c +++ b/tests/checkout/crlf.c @@ -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", ""); +} diff --git a/tests/resources/crlf/.gitted/index b/tests/resources/crlf/.gitted/index new file mode 100644 index 0000000000000000000000000000000000000000..aadd35e727f2e85193543ce386088ad798288885 GIT binary patch literal 425 zcmZ?q402{*U|<4b)=<8$N>xp)LwG`rLFH4?h0j^dZbh|y|bNxGdI5|72+V6J76@_Uw6>V z5n{Q=usPzRap#owuwuoCSF7GHbm?JW2b%+S5KKRehMIF1%^Zejb05v#bn%+Acem!c z@~9h!p7aDyWZpkyT)7)|;xjE`zK2Pep)Yq`1 b<~3VH=)bxro93>1-1WZY?bnq(zGqzk=&^); literal 0 HcmV?d00001 diff --git a/tests/resources/crlf/.gitted/objects/16/c72b67861f8524a5bebc05cd20472d3fca00da b/tests/resources/crlf/.gitted/objects/16/c72b67861f8524a5bebc05cd20472d3fca00da new file mode 100644 index 0000000000000000000000000000000000000000..e2b199458a2a0ae90b13e311605757afb96c772d GIT binary patch literal 64 zcmV-G0Kflu0V^p=O;s>7G-NO|FfcPQQ7B0*E-}uQs~BI@)IuIdZyxJ;Rw2v6kz literal 0 HcmV?d00001 diff --git a/tests/resources/crlf/.gitted/objects/47/fbc2c28a18df0dc773276a253eb85c7516ca50 b/tests/resources/crlf/.gitted/objects/47/fbc2c28a18df0dc773276a253eb85c7516ca50 new file mode 100644 index 0000000000000000000000000000000000000000..d16db963350a363f848c5edbb98d186df2a9d264 GIT binary patch literal 36 scmb literal 0 HcmV?d00001 diff --git a/tests/resources/crlf/.gitted/objects/4b/825dc642cb6eb9a060e54bf8d69288fbee4904 b/tests/resources/crlf/.gitted/objects/4b/825dc642cb6eb9a060e54bf8d69288fbee4904 new file mode 100644 index 0000000000000000000000000000000000000000..adf64119a33d7621aeeaa505d30adb58afaa5559 GIT binary patch literal 15 Wcmb7G-NO|FfcPQQ7B0*E-}jODom_Vi-f=_te$z%Mb=f8n#B8+7S$RkN^u|D^=42qQK^g-F{P9xrI`hZ z;!Kt1tkWb>Qwfd_yS5ImET4xCc+tLZ<9d7#czXY{xAU;RvGGaT{tSUIdx}#)c=YJK gyX$?`^j{HosZ}dTyV>u)H8359C;Kw@1OGi#i8TOMqW}N^ literal 0 HcmV?d00001 diff --git a/tests/resources/crlf/.gitted/objects/97/449da2d225557c558ac244384d487e66c3e591 b/tests/resources/crlf/.gitted/objects/97/449da2d225557c558ac244384d487e66c3e591 new file mode 100644 index 0000000000000000000000000000000000000000..d3917a4332bc5bffbcdca9b347a0b71771ae704e GIT binary patch literal 177 zcmV;i08amS0j1APPQx$|hGEt|#q5#Lc>I@2sDf1`ZZR2;Nf2&|?JRox25|(o&*Ihh z$yVz+fP#M-O%-gEL~~42v}Fq9Im|i>2FZjzQFcWbF|)aG)9V0NPI1nMsY}sDq{xNY zQ4s4VQSr=?GJ3=NShfZqEI+$;xM-_uU-o;4*RMbOeCwmFJorVndIsw$p?Bfr;28y*>|M=u)1k%$pGjfR8q_O}(a>FWdC^$HpQ literal 0 HcmV?d00001