@@ -68,7 +68,7 @@ check_warning () {
6868 esac
6969}
7070
71- create_file_in_repo () {
71+ commit_check_warn () {
7272 crlf=$1
7373 attr=$2
7474 lfname=$3
@@ -109,7 +109,7 @@ check_files_in_repo () {
109109}
110110
111111
112- check_files_in_ws () {
112+ checkout_files () {
113113 eol=$1
114114 crlf=$2
115115 attr=$3
@@ -169,40 +169,40 @@ test_expect_success 'setup master' '
169169warn_LF_CRLF=" LF will be replaced by CRLF"
170170warn_CRLF_LF=" CRLF will be replaced by LF"
171171
172- test_expect_success ' add files empty attr' '
173- create_file_in_repo false "" "" "" "" "" "" &&
174- create_file_in_repo true "" "LF_CRLF" "" "LF_CRLF" "" "" &&
175- create_file_in_repo input "" "" "CRLF_LF" "CRLF_LF" "" ""
172+ test_expect_success ' commit files empty attr' '
173+ commit_check_warn false "" "" "" "" "" "" &&
174+ commit_check_warn true "" "LF_CRLF" "" "LF_CRLF" "" "" &&
175+ commit_check_warn input "" "" "CRLF_LF" "CRLF_LF" "" ""
176176'
177177
178- test_expect_success ' add files attr=auto' '
179- create_file_in_repo false "auto" "" "CRLF_LF" "CRLF_LF" "" "" &&
180- create_file_in_repo true "auto" "LF_CRLF" "" "LF_CRLF" "" "" &&
181- create_file_in_repo input "auto" "" "CRLF_LF" "CRLF_LF" "" ""
178+ test_expect_success ' commit files attr=auto' '
179+ commit_check_warn false "auto" "" "CRLF_LF" "CRLF_LF" "" "" &&
180+ commit_check_warn true "auto" "LF_CRLF" "" "LF_CRLF" "" "" &&
181+ commit_check_warn input "auto" "" "CRLF_LF" "CRLF_LF" "" ""
182182'
183183
184- test_expect_success ' add files attr=text' '
185- create_file_in_repo false "text" "" "CRLF_LF" "CRLF_LF" "" "CRLF_LF" &&
186- create_file_in_repo true "text" "LF_CRLF" "" "LF_CRLF" "LF_CRLF" "" &&
187- create_file_in_repo input "text" "" "CRLF_LF" "CRLF_LF" "" "CRLF_LF"
184+ test_expect_success ' commit files attr=text' '
185+ commit_check_warn false "text" "" "CRLF_LF" "CRLF_LF" "" "CRLF_LF" &&
186+ commit_check_warn true "text" "LF_CRLF" "" "LF_CRLF" "LF_CRLF" "" &&
187+ commit_check_warn input "text" "" "CRLF_LF" "CRLF_LF" "" "CRLF_LF"
188188'
189189
190- test_expect_success ' add files attr=-text' '
191- create_file_in_repo false "-text" "" "" "" "" "" &&
192- create_file_in_repo true "-text" "" "" "" "" "" &&
193- create_file_in_repo input "-text" "" "" "" "" ""
190+ test_expect_success ' commit files attr=-text' '
191+ commit_check_warn false "-text" "" "" "" "" "" &&
192+ commit_check_warn true "-text" "" "" "" "" "" &&
193+ commit_check_warn input "-text" "" "" "" "" ""
194194'
195195
196- test_expect_success ' add files attr=lf' '
197- create_file_in_repo false "lf" "" "CRLF_LF" "CRLF_LF" "" "CRLF_LF" &&
198- create_file_in_repo true "lf" "" "CRLF_LF" "CRLF_LF" "" "CRLF_LF" &&
199- create_file_in_repo input "lf" "" "CRLF_LF" "CRLF_LF" "" "CRLF_LF"
196+ test_expect_success ' commit files attr=lf' '
197+ commit_check_warn false "lf" "" "CRLF_LF" "CRLF_LF" "" "CRLF_LF" &&
198+ commit_check_warn true "lf" "" "CRLF_LF" "CRLF_LF" "" "CRLF_LF" &&
199+ commit_check_warn input "lf" "" "CRLF_LF" "CRLF_LF" "" "CRLF_LF"
200200'
201201
202- test_expect_success ' add files attr=crlf' '
203- create_file_in_repo false "crlf" "LF_CRLF" "" "LF_CRLF" "LF_CRLF" "" &&
204- create_file_in_repo true "crlf" "LF_CRLF" "" "LF_CRLF" "LF_CRLF" "" &&
205- create_file_in_repo input "crlf" "LF_CRLF" "" "LF_CRLF" "LF_CRLF" ""
202+ test_expect_success ' commit files attr=crlf' '
203+ commit_check_warn false "crlf" "LF_CRLF" "" "LF_CRLF" "LF_CRLF" "" &&
204+ commit_check_warn true "crlf" "LF_CRLF" "" "LF_CRLF" "LF_CRLF" "" &&
205+ commit_check_warn input "crlf" "LF_CRLF" "" "LF_CRLF" "LF_CRLF" ""
206206'
207207
208208test_expect_success ' create files cleanup' '
@@ -237,7 +237,7 @@ test_expect_success 'commit -text' '
237237# ###############################################################################
238238# Check how files in the repo are changed when they are checked out
239239# How to read the table below:
240- # - check_files_in_ws will check multiple files with a combination of settings
240+ # - checkout_files will check multiple files with a combination of settings
241241# and attributes (core.autocrlf=input is forbidden with core.eol=crlf)
242242# - parameter $1 : core.eol lf | crlf
243243# - parameter $2 : core.autocrlf false | true | input
@@ -249,8 +249,8 @@ test_expect_success 'commit -text' '
249249# - parameter $8 : reference for a file with CRLF and a NUL (should be handled as binary when auto)
250250
251251# What we have in the repo:
252- # ----------------- EOL in repo ----------------
253- # LF CRLF CRLF_mix_LF LF_mix_CR CRLF_nul
252+ # ----------------- EOL in repo ----------------
253+ # LF CRLF CRLF_mix_LF LF_mix_CR CRLF_nul
254254# settings with checkout:
255255# core. core. .gitattr
256256# eol acrlf
@@ -268,68 +268,68 @@ NL=LF
268268fi
269269export CRLF_MIX_LF_CR MIX NL
270270
271- check_files_in_ws lf false " " LF CRLF CRLF_mix_LF LF_mix_CR CRLF_nul
272- check_files_in_ws lf true " " CRLF CRLF CRLF_mix_LF LF_mix_CR CRLF_nul
273- check_files_in_ws lf input " " LF CRLF CRLF_mix_LF LF_mix_CR CRLF_nul
274- check_files_in_ws lf false " auto" LF CRLF CRLF_mix_LF LF_mix_CR CRLF_nul
275- check_files_in_ws lf true " auto" CRLF CRLF CRLF LF_mix_CR CRLF_nul
276- check_files_in_ws lf input " auto" LF CRLF CRLF_mix_LF LF_mix_CR CRLF_nul
277- check_files_in_ws lf false " text" LF CRLF CRLF_mix_LF LF_mix_CR CRLF_nul
278- check_files_in_ws lf true " text" CRLF CRLF CRLF CRLF_mix_CR CRLF_nul
279- check_files_in_ws lf input " text" LF CRLF CRLF_mix_LF LF_mix_CR CRLF_nul
280- check_files_in_ws lf false " -text" LF CRLF CRLF_mix_LF LF_mix_CR CRLF_nul
281- check_files_in_ws lf true " -text" LF CRLF CRLF_mix_LF LF_mix_CR CRLF_nul
282- check_files_in_ws lf input " -text" LF CRLF CRLF_mix_LF LF_mix_CR CRLF_nul
283- check_files_in_ws lf false " lf" LF CRLF CRLF_mix_LF LF_mix_CR CRLF_nul
284- check_files_in_ws lf true " lf" LF CRLF CRLF_mix_LF LF_mix_CR CRLF_nul
285- check_files_in_ws lf input " lf" LF CRLF CRLF_mix_LF LF_mix_CR CRLF_nul
286- check_files_in_ws lf false " crlf" CRLF CRLF CRLF CRLF_mix_CR CRLF_nul
287- check_files_in_ws lf true " crlf" CRLF CRLF CRLF CRLF_mix_CR CRLF_nul
288- check_files_in_ws lf input " crlf" CRLF CRLF CRLF CRLF_mix_CR CRLF_nul
289-
290- check_files_in_ws crlf false " " LF CRLF CRLF_mix_LF LF_mix_CR CRLF_nul
291- check_files_in_ws crlf true " " CRLF CRLF CRLF_mix_LF LF_mix_CR CRLF_nul
292- check_files_in_ws crlf false " auto" CRLF CRLF CRLF LF_mix_CR CRLF_nul
293- check_files_in_ws crlf true " auto" CRLF CRLF CRLF LF_mix_CR CRLF_nul
294- check_files_in_ws crlf false " text" CRLF CRLF CRLF CRLF_mix_CR CRLF_nul
295- check_files_in_ws crlf true " text" CRLF CRLF CRLF CRLF_mix_CR CRLF_nul
296- check_files_in_ws crlf false " -text" LF CRLF CRLF_mix_LF LF_mix_CR CRLF_nul
297- check_files_in_ws crlf true " -text" LF CRLF CRLF_mix_LF LF_mix_CR CRLF_nul
298- check_files_in_ws crlf false " lf" LF CRLF CRLF_mix_LF LF_mix_CR CRLF_nul
299- check_files_in_ws crlf true " lf" LF CRLF CRLF_mix_LF LF_mix_CR CRLF_nul
300- check_files_in_ws crlf false " crlf" CRLF CRLF CRLF CRLF_mix_CR CRLF_nul
301- check_files_in_ws crlf true " crlf" CRLF CRLF CRLF CRLF_mix_CR CRLF_nul
302-
303- check_files_in_ws " " false " " LF CRLF CRLF_mix_LF LF_mix_CR CRLF_nul
304- check_files_in_ws " " true " " CRLF CRLF CRLF_mix_LF LF_mix_CR CRLF_nul
305- check_files_in_ws " " input " " LF CRLF CRLF_mix_LF LF_mix_CR CRLF_nul
306- check_files_in_ws " " false " auto" $NL CRLF $MIX_CRLF_LF LF_mix_CR CRLF_nul
307- check_files_in_ws " " true " auto" CRLF CRLF CRLF LF_mix_CR CRLF_nul
308- check_files_in_ws " " input " auto" LF CRLF CRLF_mix_LF LF_mix_CR CRLF_nul
309- check_files_in_ws " " false " text" $NL CRLF $MIX_CRLF_LF $MIX_LF_CR CRLF_nul
310- check_files_in_ws " " true " text" CRLF CRLF CRLF CRLF_mix_CR CRLF_nul
311- check_files_in_ws " " input " text" LF CRLF CRLF_mix_LF LF_mix_CR CRLF_nul
312- check_files_in_ws " " false " -text" LF CRLF CRLF_mix_LF LF_mix_CR CRLF_nul
313- check_files_in_ws " " true " -text" LF CRLF CRLF_mix_LF LF_mix_CR CRLF_nul
314- check_files_in_ws " " input " -text" LF CRLF CRLF_mix_LF LF_mix_CR CRLF_nul
315- check_files_in_ws " " false " lf" LF CRLF CRLF_mix_LF LF_mix_CR CRLF_nul
316- check_files_in_ws " " true " lf" LF CRLF CRLF_mix_LF LF_mix_CR CRLF_nul
317- check_files_in_ws " " input " lf" LF CRLF CRLF_mix_LF LF_mix_CR CRLF_nul
318- check_files_in_ws " " false " crlf" CRLF CRLF CRLF CRLF_mix_CR CRLF_nul
319- check_files_in_ws " " true " crlf" CRLF CRLF CRLF CRLF_mix_CR CRLF_nul
320- check_files_in_ws " " input " crlf" CRLF CRLF CRLF CRLF_mix_CR CRLF_nul
321-
322- check_files_in_ws native false " " LF CRLF CRLF_mix_LF LF_mix_CR CRLF_nul
323- check_files_in_ws native true " " CRLF CRLF CRLF_mix_LF LF_mix_CR CRLF_nul
324- check_files_in_ws native false " auto" $NL CRLF $MIX_CRLF_LF LF_mix_CR CRLF_nul
325- check_files_in_ws native true " auto" CRLF CRLF CRLF LF_mix_CR CRLF_nul
326- check_files_in_ws native false " text" $NL CRLF $MIX_CRLF_LF $MIX_LF_CR CRLF_nul
327- check_files_in_ws native true " text" CRLF CRLF CRLF CRLF_mix_CR CRLF_nul
328- check_files_in_ws native false " -text" LF CRLF CRLF_mix_LF LF_mix_CR CRLF_nul
329- check_files_in_ws native true " -text" LF CRLF CRLF_mix_LF LF_mix_CR CRLF_nul
330- check_files_in_ws native false " lf" LF CRLF CRLF_mix_LF LF_mix_CR CRLF_nul
331- check_files_in_ws native true " lf" LF CRLF CRLF_mix_LF LF_mix_CR CRLF_nul
332- check_files_in_ws native false " crlf" CRLF CRLF CRLF CRLF_mix_CR CRLF_nul
333- check_files_in_ws native true " crlf" CRLF CRLF CRLF CRLF_mix_CR CRLF_nul
271+ checkout_files lf false " " LF CRLF CRLF_mix_LF LF_mix_CR CRLF_nul
272+ checkout_files lf true " " CRLF CRLF CRLF_mix_LF LF_mix_CR CRLF_nul
273+ checkout_files lf input " " LF CRLF CRLF_mix_LF LF_mix_CR CRLF_nul
274+ checkout_files lf false " auto" LF CRLF CRLF_mix_LF LF_mix_CR CRLF_nul
275+ checkout_files lf true " auto" CRLF CRLF CRLF LF_mix_CR CRLF_nul
276+ checkout_files lf input " auto" LF CRLF CRLF_mix_LF LF_mix_CR CRLF_nul
277+ checkout_files lf false " text" LF CRLF CRLF_mix_LF LF_mix_CR CRLF_nul
278+ checkout_files lf true " text" CRLF CRLF CRLF CRLF_mix_CR CRLF_nul
279+ checkout_files lf input " text" LF CRLF CRLF_mix_LF LF_mix_CR CRLF_nul
280+ checkout_files lf false " -text" LF CRLF CRLF_mix_LF LF_mix_CR CRLF_nul
281+ checkout_files lf true " -text" LF CRLF CRLF_mix_LF LF_mix_CR CRLF_nul
282+ checkout_files lf input " -text" LF CRLF CRLF_mix_LF LF_mix_CR CRLF_nul
283+ checkout_files lf false " lf" LF CRLF CRLF_mix_LF LF_mix_CR CRLF_nul
284+ checkout_files lf true " lf" LF CRLF CRLF_mix_LF LF_mix_CR CRLF_nul
285+ checkout_files lf input " lf" LF CRLF CRLF_mix_LF LF_mix_CR CRLF_nul
286+ checkout_files lf false " crlf" CRLF CRLF CRLF CRLF_mix_CR CRLF_nul
287+ checkout_files lf true " crlf" CRLF CRLF CRLF CRLF_mix_CR CRLF_nul
288+ checkout_files lf input " crlf" CRLF CRLF CRLF CRLF_mix_CR CRLF_nul
289+
290+ checkout_files crlf false " " LF CRLF CRLF_mix_LF LF_mix_CR CRLF_nul
291+ checkout_files crlf true " " CRLF CRLF CRLF_mix_LF LF_mix_CR CRLF_nul
292+ checkout_files crlf false " auto" CRLF CRLF CRLF LF_mix_CR CRLF_nul
293+ checkout_files crlf true " auto" CRLF CRLF CRLF LF_mix_CR CRLF_nul
294+ checkout_files crlf false " text" CRLF CRLF CRLF CRLF_mix_CR CRLF_nul
295+ checkout_files crlf true " text" CRLF CRLF CRLF CRLF_mix_CR CRLF_nul
296+ checkout_files crlf false " -text" LF CRLF CRLF_mix_LF LF_mix_CR CRLF_nul
297+ checkout_files crlf true " -text" LF CRLF CRLF_mix_LF LF_mix_CR CRLF_nul
298+ checkout_files crlf false " lf" LF CRLF CRLF_mix_LF LF_mix_CR CRLF_nul
299+ checkout_files crlf true " lf" LF CRLF CRLF_mix_LF LF_mix_CR CRLF_nul
300+ checkout_files crlf false " crlf" CRLF CRLF CRLF CRLF_mix_CR CRLF_nul
301+ checkout_files crlf true " crlf" CRLF CRLF CRLF CRLF_mix_CR CRLF_nul
302+
303+ checkout_files " " false " " LF CRLF CRLF_mix_LF LF_mix_CR CRLF_nul
304+ checkout_files " " true " " CRLF CRLF CRLF_mix_LF LF_mix_CR CRLF_nul
305+ checkout_files " " input " " LF CRLF CRLF_mix_LF LF_mix_CR CRLF_nul
306+ checkout_files " " false " auto" $NL CRLF $MIX_CRLF_LF LF_mix_CR CRLF_nul
307+ checkout_files " " true " auto" CRLF CRLF CRLF LF_mix_CR CRLF_nul
308+ checkout_files " " input " auto" LF CRLF CRLF_mix_LF LF_mix_CR CRLF_nul
309+ checkout_files " " false " text" $NL CRLF $MIX_CRLF_LF $MIX_LF_CR CRLF_nul
310+ checkout_files " " true " text" CRLF CRLF CRLF CRLF_mix_CR CRLF_nul
311+ checkout_files " " input " text" LF CRLF CRLF_mix_LF LF_mix_CR CRLF_nul
312+ checkout_files " " false " -text" LF CRLF CRLF_mix_LF LF_mix_CR CRLF_nul
313+ checkout_files " " true " -text" LF CRLF CRLF_mix_LF LF_mix_CR CRLF_nul
314+ checkout_files " " input " -text" LF CRLF CRLF_mix_LF LF_mix_CR CRLF_nul
315+ checkout_files " " false " lf" LF CRLF CRLF_mix_LF LF_mix_CR CRLF_nul
316+ checkout_files " " true " lf" LF CRLF CRLF_mix_LF LF_mix_CR CRLF_nul
317+ checkout_files " " input " lf" LF CRLF CRLF_mix_LF LF_mix_CR CRLF_nul
318+ checkout_files " " false " crlf" CRLF CRLF CRLF CRLF_mix_CR CRLF_nul
319+ checkout_files " " true " crlf" CRLF CRLF CRLF CRLF_mix_CR CRLF_nul
320+ checkout_files " " input " crlf" CRLF CRLF CRLF CRLF_mix_CR CRLF_nul
321+
322+ checkout_files native false " " LF CRLF CRLF_mix_LF LF_mix_CR CRLF_nul
323+ checkout_files native true " " CRLF CRLF CRLF_mix_LF LF_mix_CR CRLF_nul
324+ checkout_files native false " auto" $NL CRLF $MIX_CRLF_LF LF_mix_CR CRLF_nul
325+ checkout_files native true " auto" CRLF CRLF CRLF LF_mix_CR CRLF_nul
326+ checkout_files native false " text" $NL CRLF $MIX_CRLF_LF $MIX_LF_CR CRLF_nul
327+ checkout_files native true " text" CRLF CRLF CRLF CRLF_mix_CR CRLF_nul
328+ checkout_files native false " -text" LF CRLF CRLF_mix_LF LF_mix_CR CRLF_nul
329+ checkout_files native true " -text" LF CRLF CRLF_mix_LF LF_mix_CR CRLF_nul
330+ checkout_files native false " lf" LF CRLF CRLF_mix_LF LF_mix_CR CRLF_nul
331+ checkout_files native true " lf" LF CRLF CRLF_mix_LF LF_mix_CR CRLF_nul
332+ checkout_files native false " crlf" CRLF CRLF CRLF CRLF_mix_CR CRLF_nul
333+ checkout_files native true " crlf" CRLF CRLF CRLF CRLF_mix_CR CRLF_nul
334334
335335test_done
0 commit comments