Fossil SCM
Comment updates.
Commit
43d6e3caf2dc5d5408c323fa9ece16366db90c49e3f11ab02d673897860325b4
Parent
80345fd14eafbf4…
1 file changed
+5
-13
+5
-13
| --- src/checkin.c | ||
| +++ src/checkin.c | ||
| @@ -3247,24 +3247,16 @@ | ||
| 3247 | 3247 | if(((CIMINI_CONVERT_EOL_INHERIT & pCI->flags) |
| 3248 | 3248 | || (CIMINI_CONVERT_EOL_UNIX & pCI->flags) |
| 3249 | 3249 | || (CIMINI_CONVERT_EOL_WINDOWS & pCI->flags)) |
| 3250 | 3250 | && blob_size(&pCI->fileContent)>0 |
| 3251 | 3251 | ){ |
| 3252 | - /* Confirm that the new content has the same EOL style as its | |
| 3253 | - ** predecessor and convert it, if needed, to the same style. Note | |
| 3254 | - ** that this inherently runs a risk of breaking content, | |
| 3255 | - ** e.g. string literals which contain embedded newlines. Note that | |
| 3256 | - ** HTML5 specifies that form-submitted TEXTAREA content gets | |
| 3257 | - ** normalized to CRLF-style: | |
| 3252 | + /* Convert to the requested EOL style. Note that this inherently | |
| 3253 | + ** runs a risk of breaking content, e.g. string literals which | |
| 3254 | + ** contain embedded newlines. Note that HTML5 specifies that | |
| 3255 | + ** form-submitted TEXTAREA content gets normalized to CRLF-style: | |
| 3258 | 3256 | ** |
| 3259 | 3257 | ** https://html.spec.whatwg.org/multipage/form-elements.html#the-textarea-element |
| 3260 | - ** | |
| 3261 | - ** More performant/efficient would be to offer a flag which says | |
| 3262 | - ** which newline form to use, converting the new copy (if needed) | |
| 3263 | - ** without having to examine the original. Since the primary use | |
| 3264 | - ** case is a web interface, it would be easy to offer it as a | |
| 3265 | - ** checkbox there. | |
| 3266 | 3258 | */ |
| 3267 | 3259 | const int pseudoBinary = LOOK_LONG | LOOK_NUL; |
| 3268 | 3260 | const int lookFlags = LOOK_CRLF | pseudoBinary; |
| 3269 | 3261 | const int lookNew = looks_like_utf8( &pCI->fileContent, lookFlags ); |
| 3270 | 3262 | if(!(pseudoBinary & lookNew)){ |
| @@ -3295,12 +3287,12 @@ | ||
| 3295 | 3287 | }else{ |
| 3296 | 3288 | const int oldSize = blob_size(&pCI->fileContent); |
| 3297 | 3289 | if(CIMINI_CONVERT_EOL_UNIX & pCI->flags){ |
| 3298 | 3290 | blob_to_lf_only(&pCI->fileContent); |
| 3299 | 3291 | }else{ |
| 3300 | - blob_add_cr(&pCI->fileContent); | |
| 3301 | 3292 | assert(CIMINI_CONVERT_EOL_WINDOWS & pCI->flags); |
| 3293 | + blob_add_cr(&pCI->fileContent); | |
| 3302 | 3294 | } |
| 3303 | 3295 | if(blob_size(&pCI->fileContent)!=oldSize){ |
| 3304 | 3296 | rehash = 1; |
| 3305 | 3297 | } |
| 3306 | 3298 | } |
| 3307 | 3299 |
| --- src/checkin.c | |
| +++ src/checkin.c | |
| @@ -3247,24 +3247,16 @@ | |
| 3247 | if(((CIMINI_CONVERT_EOL_INHERIT & pCI->flags) |
| 3248 | || (CIMINI_CONVERT_EOL_UNIX & pCI->flags) |
| 3249 | || (CIMINI_CONVERT_EOL_WINDOWS & pCI->flags)) |
| 3250 | && blob_size(&pCI->fileContent)>0 |
| 3251 | ){ |
| 3252 | /* Confirm that the new content has the same EOL style as its |
| 3253 | ** predecessor and convert it, if needed, to the same style. Note |
| 3254 | ** that this inherently runs a risk of breaking content, |
| 3255 | ** e.g. string literals which contain embedded newlines. Note that |
| 3256 | ** HTML5 specifies that form-submitted TEXTAREA content gets |
| 3257 | ** normalized to CRLF-style: |
| 3258 | ** |
| 3259 | ** https://html.spec.whatwg.org/multipage/form-elements.html#the-textarea-element |
| 3260 | ** |
| 3261 | ** More performant/efficient would be to offer a flag which says |
| 3262 | ** which newline form to use, converting the new copy (if needed) |
| 3263 | ** without having to examine the original. Since the primary use |
| 3264 | ** case is a web interface, it would be easy to offer it as a |
| 3265 | ** checkbox there. |
| 3266 | */ |
| 3267 | const int pseudoBinary = LOOK_LONG | LOOK_NUL; |
| 3268 | const int lookFlags = LOOK_CRLF | pseudoBinary; |
| 3269 | const int lookNew = looks_like_utf8( &pCI->fileContent, lookFlags ); |
| 3270 | if(!(pseudoBinary & lookNew)){ |
| @@ -3295,12 +3287,12 @@ | |
| 3295 | }else{ |
| 3296 | const int oldSize = blob_size(&pCI->fileContent); |
| 3297 | if(CIMINI_CONVERT_EOL_UNIX & pCI->flags){ |
| 3298 | blob_to_lf_only(&pCI->fileContent); |
| 3299 | }else{ |
| 3300 | blob_add_cr(&pCI->fileContent); |
| 3301 | assert(CIMINI_CONVERT_EOL_WINDOWS & pCI->flags); |
| 3302 | } |
| 3303 | if(blob_size(&pCI->fileContent)!=oldSize){ |
| 3304 | rehash = 1; |
| 3305 | } |
| 3306 | } |
| 3307 |
| --- src/checkin.c | |
| +++ src/checkin.c | |
| @@ -3247,24 +3247,16 @@ | |
| 3247 | if(((CIMINI_CONVERT_EOL_INHERIT & pCI->flags) |
| 3248 | || (CIMINI_CONVERT_EOL_UNIX & pCI->flags) |
| 3249 | || (CIMINI_CONVERT_EOL_WINDOWS & pCI->flags)) |
| 3250 | && blob_size(&pCI->fileContent)>0 |
| 3251 | ){ |
| 3252 | /* Convert to the requested EOL style. Note that this inherently |
| 3253 | ** runs a risk of breaking content, e.g. string literals which |
| 3254 | ** contain embedded newlines. Note that HTML5 specifies that |
| 3255 | ** form-submitted TEXTAREA content gets normalized to CRLF-style: |
| 3256 | ** |
| 3257 | ** https://html.spec.whatwg.org/multipage/form-elements.html#the-textarea-element |
| 3258 | */ |
| 3259 | const int pseudoBinary = LOOK_LONG | LOOK_NUL; |
| 3260 | const int lookFlags = LOOK_CRLF | pseudoBinary; |
| 3261 | const int lookNew = looks_like_utf8( &pCI->fileContent, lookFlags ); |
| 3262 | if(!(pseudoBinary & lookNew)){ |
| @@ -3295,12 +3287,12 @@ | |
| 3287 | }else{ |
| 3288 | const int oldSize = blob_size(&pCI->fileContent); |
| 3289 | if(CIMINI_CONVERT_EOL_UNIX & pCI->flags){ |
| 3290 | blob_to_lf_only(&pCI->fileContent); |
| 3291 | }else{ |
| 3292 | assert(CIMINI_CONVERT_EOL_WINDOWS & pCI->flags); |
| 3293 | blob_add_cr(&pCI->fileContent); |
| 3294 | } |
| 3295 | if(blob_size(&pCI->fileContent)!=oldSize){ |
| 3296 | rehash = 1; |
| 3297 | } |
| 3298 | } |
| 3299 |