* [PATCH v2 2/2] t0027: Support NATIVE_CRLF
@ 2015-04-17 15:44 Torsten Bögershausen
2015-04-17 17:00 ` Torsten Bögershausen
` (2 more replies)
0 siblings, 3 replies; 7+ messages in thread
From: Torsten Bögershausen @ 2015-04-17 15:44 UTC (permalink / raw)
To: git; +Cc: tboegi, johannes.schindelin
Without this patch, t0027 expects the native end-of-lines to be a single
line feed character. On Windows, however, we set it to a carriage return
character followed by a line feed character. Thus, we have to modify
t0027 to expect different warnings depending on the end-of-line markers.
Adjust the check of the warnings and use these macros:
WILC: Warn if LF becomes CRLF
WICL: Warn if CRLF becomes LF
WAMIX: Mixed line endings: either CRLF->LF or LF->CRLF
Improve the information given by check_warning():
Use test_cmp to show which warning is missing (or should'n t be there)
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Torsten Bögershausen <tboegi@web.de>
---
t/t0027-auto-crlf.sh | 30 ++++++++++++++++++++----------
1 file changed, 20 insertions(+), 10 deletions(-)
diff --git a/t/t0027-auto-crlf.sh b/t/t0027-auto-crlf.sh
index 5858397..8975b97 100755
--- a/t/t0027-auto-crlf.sh
+++ b/t/t0027-auto-crlf.sh
@@ -57,15 +57,13 @@ create_gitattributes () {
check_warning () {
case "$1" in
- LF_CRLF) grep "LF will be replaced by CRLF" $2;;
- CRLF_LF) grep "CRLF will be replaced by LF" $2;;
- '')
- >expect
- grep "will be replaced by" $2 >actual
- test_cmp expect actual
- ;;
- *) false ;;
+ LF_CRLF) echo "warning: LF will be replaced by CRLF" >"$2".expect ;;
+ CRLF_LF) echo "warning: CRLF will be replaced by LF" >"$2".expect ;;
+ '') >"$2".expect ;;
+ *) echo >&2 "Illegal 1": "$1" ; return false ;;
esac
+ grep "will be replaced by" "$2" | sed -e "s/\(.*\) in [^ ]*$/\1/" >"$2".actual
+ test_cmp "$2".expect "$2".actual
}
commit_check_warn () {
@@ -169,6 +167,18 @@ test_expect_success 'setup master' '
warn_LF_CRLF="LF will be replaced by CRLF"
warn_CRLF_LF="CRLF will be replaced by LF"
+#WILC means "Warn if (this OS) converts LF into CRLF"
+if test_have_prereq NATIVE_CRLF
+then
+WILC=LF_CRLF
+WICL=
+WAMIX=LF_CRLF
+else
+WILC=
+WICL=CRLF_LF
+WAMIX=CRLF_LF
+fi
+
test_expect_success 'commit files empty attr' '
commit_check_warn false "" "" "" "" "" "" &&
commit_check_warn true "" "LF_CRLF" "" "LF_CRLF" "" "" &&
@@ -176,13 +186,13 @@ test_expect_success 'commit files empty attr' '
'
test_expect_success 'commit files attr=auto' '
- commit_check_warn false "auto" "" "CRLF_LF" "CRLF_LF" "" "" &&
+ commit_check_warn false "auto" "$WILC" "$WICL" "$WAMIX" "" "" &&
commit_check_warn true "auto" "LF_CRLF" "" "LF_CRLF" "" "" &&
commit_check_warn input "auto" "" "CRLF_LF" "CRLF_LF" "" ""
'
test_expect_success 'commit files attr=text' '
- commit_check_warn false "text" "" "CRLF_LF" "CRLF_LF" "" "CRLF_LF" &&
+ commit_check_warn false "text" "$WILC" "$WICL" "$WAMIX" "$WILC" "$WICL" &&
commit_check_warn true "text" "LF_CRLF" "" "LF_CRLF" "LF_CRLF" "" &&
commit_check_warn input "text" "" "CRLF_LF" "CRLF_LF" "" "CRLF_LF"
'
--
2.2.0.rc1.790.ge19fcd2
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH v2 2/2] t0027: Support NATIVE_CRLF
2015-04-17 15:44 [PATCH v2 2/2] t0027: Support NATIVE_CRLF Torsten Bögershausen
@ 2015-04-17 17:00 ` Torsten Bögershausen
2015-04-17 19:37 ` Johannes Schindelin
2015-04-17 19:55 ` Johannes Schindelin
2015-04-17 20:44 ` Eric Sunshine
2 siblings, 1 reply; 7+ messages in thread
From: Torsten Bögershausen @ 2015-04-17 17:00 UTC (permalink / raw)
To: Torsten Bögershausen, git; +Cc: johannes.schindelin
On 2015-04-17 17.44, Torsten Bögershausen wrote:
> Without this patch, t0027 expects the native end-of-lines to be a single
> line feed character. On Windows, however, we set it to a carriage return
> character followed by a line feed character. Thus, we have to modify
> t0027 to expect different warnings depending on the end-of-line markers.
>
> Adjust the check of the warnings and use these macros:
> WILC: Warn if LF becomes CRLF
> WICL: Warn if CRLF becomes LF
> WAMIX: Mixed line endings: either CRLF->LF or LF->CRLF
>
> Improve the information given by check_warning():
> Use test_cmp to show which warning is missing (or should'n t be there)
>
> Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
> Signed-off-by: Torsten Bögershausen <tboegi@web.de>
Originally I wanted to have Dscho as "Author", is that OK with you ?
(But the "From:" line didn't made it through my email program)
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH v2 2/2] t0027: Support NATIVE_CRLF
2015-04-17 17:00 ` Torsten Bögershausen
@ 2015-04-17 19:37 ` Johannes Schindelin
0 siblings, 0 replies; 7+ messages in thread
From: Johannes Schindelin @ 2015-04-17 19:37 UTC (permalink / raw)
To: Torsten Bögershausen; +Cc: git
Hi Torsten,
On 2015-04-17 19:00, Torsten Bögershausen wrote:
> On 2015-04-17 17.44, Torsten Bögershausen wrote:
>> Without this patch, t0027 expects the native end-of-lines to be a single
>> line feed character. On Windows, however, we set it to a carriage return
>> character followed by a line feed character. Thus, we have to modify
>> t0027 to expect different warnings depending on the end-of-line markers.
>>
>> Adjust the check of the warnings and use these macros:
>> WILC: Warn if LF becomes CRLF
>> WICL: Warn if CRLF becomes LF
>> WAMIX: Mixed line endings: either CRLF->LF or LF->CRLF
>>
>> Improve the information given by check_warning():
>> Use test_cmp to show which warning is missing (or should'n t be there)
>>
>> Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
>> Signed-off-by: Torsten Bögershausen <tboegi@web.de>
> Originally I wanted to have Dscho as "Author", is that OK with you ?
> (But the "From:" line didn't made it through my email program)
No worries.
Dscho
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH v2 2/2] t0027: Support NATIVE_CRLF
2015-04-17 15:44 [PATCH v2 2/2] t0027: Support NATIVE_CRLF Torsten Bögershausen
2015-04-17 17:00 ` Torsten Bögershausen
@ 2015-04-17 19:55 ` Johannes Schindelin
2015-04-17 21:04 ` Junio C Hamano
2015-04-17 20:44 ` Eric Sunshine
2 siblings, 1 reply; 7+ messages in thread
From: Johannes Schindelin @ 2015-04-17 19:55 UTC (permalink / raw)
To: Torsten Bögershausen; +Cc: git
Hi Torsten,
On 2015-04-17 17:44, Torsten Bögershausen wrote:
> Without this patch, t0027 expects the native end-of-lines to be a single
> line feed character. On Windows, however, we set it to a carriage return
> character followed by a line feed character. Thus, we have to modify
> t0027 to expect different warnings depending on the end-of-line markers.
>
> Adjust the check of the warnings and use these macros:
> WILC: Warn if LF becomes CRLF
> WICL: Warn if CRLF becomes LF
> WAMIX: Mixed line endings: either CRLF->LF or LF->CRLF
>
> Improve the information given by check_warning():
> Use test_cmp to show which warning is missing (or should'n t be there)
>
> Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
> Signed-off-by: Torsten Bögershausen <tboegi@web.de>
Thank you so much!
Dscho
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH v2 2/2] t0027: Support NATIVE_CRLF
2015-04-17 19:55 ` Johannes Schindelin
@ 2015-04-17 21:04 ` Junio C Hamano
2015-04-18 14:54 ` Johannes Schindelin
0 siblings, 1 reply; 7+ messages in thread
From: Junio C Hamano @ 2015-04-17 21:04 UTC (permalink / raw)
To: Johannes Schindelin; +Cc: Torsten Bögershausen, git
Johannes Schindelin <johannes.schindelin@gmx.de> writes:
> Hi Torsten,
>
> On 2015-04-17 17:44, Torsten Bögershausen wrote:
>> Without this patch, t0027 expects the native end-of-lines to be a single
>> line feed character. On Windows, however, we set it to a carriage return
>> character followed by a line feed character. Thus, we have to modify
>> t0027 to expect different warnings depending on the end-of-line markers.
>>
>> Adjust the check of the warnings and use these macros:
>> WILC: Warn if LF becomes CRLF
>> WICL: Warn if CRLF becomes LF
>> WAMIX: Mixed line endings: either CRLF->LF or LF->CRLF
>>
>> Improve the information given by check_warning():
>> Use test_cmp to show which warning is missing (or should'n t be there)
>>
>> Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
>> Signed-off-by: Torsten Bögershausen <tboegi@web.de>
>
> Thank you so much!
> Dscho
Thanks, is that "Acked-by: Dscho" for both patches?
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH v2 2/2] t0027: Support NATIVE_CRLF
2015-04-17 21:04 ` Junio C Hamano
@ 2015-04-18 14:54 ` Johannes Schindelin
0 siblings, 0 replies; 7+ messages in thread
From: Johannes Schindelin @ 2015-04-18 14:54 UTC (permalink / raw)
To: Junio C Hamano; +Cc: Torsten Bögershausen, git
Hi Junio,
On 2015-04-17 23:04, Junio C Hamano wrote:
> Johannes Schindelin <johannes.schindelin@gmx.de> writes:
>
>> On 2015-04-17 17:44, Torsten Bögershausen wrote:
>>> Without this patch, t0027 expects the native end-of-lines to be a single
>>> line feed character. On Windows, however, we set it to a carriage return
>>> character followed by a line feed character. Thus, we have to modify
>>> t0027 to expect different warnings depending on the end-of-line markers.
>>>
>>> Adjust the check of the warnings and use these macros:
>>> WILC: Warn if LF becomes CRLF
>>> WICL: Warn if CRLF becomes LF
>>> WAMIX: Mixed line endings: either CRLF->LF or LF->CRLF
>>>
>>> Improve the information given by check_warning():
>>> Use test_cmp to show which warning is missing (or should'n t be there)
>>>
>>> Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
>>> Signed-off-by: Torsten Bögershausen <tboegi@web.de>
>>
>> Thank you so much!
>> Dscho
>
> Thanks, is that "Acked-by: Dscho" for both patches?
Oops, yes:
Acked-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Sorry!
Dscho
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH v2 2/2] t0027: Support NATIVE_CRLF
2015-04-17 15:44 [PATCH v2 2/2] t0027: Support NATIVE_CRLF Torsten Bögershausen
2015-04-17 17:00 ` Torsten Bögershausen
2015-04-17 19:55 ` Johannes Schindelin
@ 2015-04-17 20:44 ` Eric Sunshine
2 siblings, 0 replies; 7+ messages in thread
From: Eric Sunshine @ 2015-04-17 20:44 UTC (permalink / raw)
To: Torsten Bögershausen; +Cc: Git List, Johannes Schindelin
On Fri, Apr 17, 2015 at 11:44 AM, Torsten Bögershausen <tboegi@web.de> wrote:
> Without this patch, t0027 expects the native end-of-lines to be a single
> line feed character. On Windows, however, we set it to a carriage return
> character followed by a line feed character. Thus, we have to modify
> t0027 to expect different warnings depending on the end-of-line markers.
>
> Adjust the check of the warnings and use these macros:
> WILC: Warn if LF becomes CRLF
> WICL: Warn if CRLF becomes LF
> WAMIX: Mixed line endings: either CRLF->LF or LF->CRLF
>
> Improve the information given by check_warning():
> Use test_cmp to show which warning is missing (or should'n t be there)
s/should'n t/shouldn't/
> Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
> Signed-off-by: Torsten Bögershausen <tboegi@web.de>
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2015-04-18 14:54 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-04-17 15:44 [PATCH v2 2/2] t0027: Support NATIVE_CRLF Torsten Bögershausen
2015-04-17 17:00 ` Torsten Bögershausen
2015-04-17 19:37 ` Johannes Schindelin
2015-04-17 19:55 ` Johannes Schindelin
2015-04-17 21:04 ` Junio C Hamano
2015-04-18 14:54 ` Johannes Schindelin
2015-04-17 20:44 ` Eric Sunshine
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).