Fossil SCM
Now it works ۠
Commit
433cb71479912889fcd280c49742679c16e67707
Parent
4358a237783f972…
1 file changed
+9
-10
+9
-10
| --- src/checkin.c | ||
| +++ src/checkin.c | ||
| @@ -442,17 +442,25 @@ | ||
| 442 | 442 | char *zInit, |
| 443 | 443 | const char *zBranch, |
| 444 | 444 | int parent_rid, |
| 445 | 445 | const char *zUserOvrd |
| 446 | 446 | ){ |
| 447 | + static const unsigned char bom[] = { 0xEF, 0xBB, 0xBF }; | |
| 447 | 448 | const char *zEditor; |
| 448 | 449 | char *zCmd; |
| 449 | 450 | char *zFile; |
| 450 | 451 | Blob text, line; |
| 451 | 452 | char *zComment; |
| 452 | 453 | int i; |
| 454 | +#ifdef _WIN32 | |
| 455 | + blob_init(&text, (const char *) bom, 3); | |
| 456 | + if( zInit && zInit[0]) { | |
| 457 | + blob_append(&text, zInit, -1); | |
| 458 | + } | |
| 459 | +#else | |
| 453 | 460 | blob_init(&text, zInit, -1); |
| 461 | +#endif | |
| 454 | 462 | blob_append(&text, |
| 455 | 463 | "\n" |
| 456 | 464 | "# Enter comments on this check-in. Lines beginning with # are ignored.\n" |
| 457 | 465 | "# The check-in comment follows wiki formatting rules.\n" |
| 458 | 466 | "#\n", -1 |
| @@ -494,20 +502,11 @@ | ||
| 494 | 502 | g.zLocalRoot); |
| 495 | 503 | } |
| 496 | 504 | #if defined(_WIN32) |
| 497 | 505 | blob_add_cr(&text); |
| 498 | 506 | #endif |
| 499 | - if( zEditor || fossil_utf8_to_console(blob_buffer(&text), blob_size(&text), 0) < 0) { | |
| 500 | - /* We have an external editor or else we cannot write directly to the | |
| 501 | - * (windows) console, so write it out in mbcs encoding. */ | |
| 502 | - struct Blob temp; | |
| 503 | - zComment = fossil_utf8_to_mbcs(blob_str(&text)); | |
| 504 | - blob_set(&temp, zComment); | |
| 505 | - blob_write_to_file(&temp, zFile); | |
| 506 | - blob_zero(&temp); | |
| 507 | - fossil_mbcs_free(zComment); | |
| 508 | - } | |
| 507 | + blob_write_to_file(&text, zFile); | |
| 509 | 508 | if( zEditor ){ |
| 510 | 509 | zCmd = mprintf("%s \"%s\"", zEditor, zFile); |
| 511 | 510 | fossil_print("%s\n", zCmd); |
| 512 | 511 | if( fossil_system(zCmd) ){ |
| 513 | 512 | fossil_panic("editor aborted"); |
| 514 | 513 |
| --- src/checkin.c | |
| +++ src/checkin.c | |
| @@ -442,17 +442,25 @@ | |
| 442 | char *zInit, |
| 443 | const char *zBranch, |
| 444 | int parent_rid, |
| 445 | const char *zUserOvrd |
| 446 | ){ |
| 447 | const char *zEditor; |
| 448 | char *zCmd; |
| 449 | char *zFile; |
| 450 | Blob text, line; |
| 451 | char *zComment; |
| 452 | int i; |
| 453 | blob_init(&text, zInit, -1); |
| 454 | blob_append(&text, |
| 455 | "\n" |
| 456 | "# Enter comments on this check-in. Lines beginning with # are ignored.\n" |
| 457 | "# The check-in comment follows wiki formatting rules.\n" |
| 458 | "#\n", -1 |
| @@ -494,20 +502,11 @@ | |
| 494 | g.zLocalRoot); |
| 495 | } |
| 496 | #if defined(_WIN32) |
| 497 | blob_add_cr(&text); |
| 498 | #endif |
| 499 | if( zEditor || fossil_utf8_to_console(blob_buffer(&text), blob_size(&text), 0) < 0) { |
| 500 | /* We have an external editor or else we cannot write directly to the |
| 501 | * (windows) console, so write it out in mbcs encoding. */ |
| 502 | struct Blob temp; |
| 503 | zComment = fossil_utf8_to_mbcs(blob_str(&text)); |
| 504 | blob_set(&temp, zComment); |
| 505 | blob_write_to_file(&temp, zFile); |
| 506 | blob_zero(&temp); |
| 507 | fossil_mbcs_free(zComment); |
| 508 | } |
| 509 | if( zEditor ){ |
| 510 | zCmd = mprintf("%s \"%s\"", zEditor, zFile); |
| 511 | fossil_print("%s\n", zCmd); |
| 512 | if( fossil_system(zCmd) ){ |
| 513 | fossil_panic("editor aborted"); |
| 514 |
| --- src/checkin.c | |
| +++ src/checkin.c | |
| @@ -442,17 +442,25 @@ | |
| 442 | char *zInit, |
| 443 | const char *zBranch, |
| 444 | int parent_rid, |
| 445 | const char *zUserOvrd |
| 446 | ){ |
| 447 | static const unsigned char bom[] = { 0xEF, 0xBB, 0xBF }; |
| 448 | const char *zEditor; |
| 449 | char *zCmd; |
| 450 | char *zFile; |
| 451 | Blob text, line; |
| 452 | char *zComment; |
| 453 | int i; |
| 454 | #ifdef _WIN32 |
| 455 | blob_init(&text, (const char *) bom, 3); |
| 456 | if( zInit && zInit[0]) { |
| 457 | blob_append(&text, zInit, -1); |
| 458 | } |
| 459 | #else |
| 460 | blob_init(&text, zInit, -1); |
| 461 | #endif |
| 462 | blob_append(&text, |
| 463 | "\n" |
| 464 | "# Enter comments on this check-in. Lines beginning with # are ignored.\n" |
| 465 | "# The check-in comment follows wiki formatting rules.\n" |
| 466 | "#\n", -1 |
| @@ -494,20 +502,11 @@ | |
| 502 | g.zLocalRoot); |
| 503 | } |
| 504 | #if defined(_WIN32) |
| 505 | blob_add_cr(&text); |
| 506 | #endif |
| 507 | blob_write_to_file(&text, zFile); |
| 508 | if( zEditor ){ |
| 509 | zCmd = mprintf("%s \"%s\"", zEditor, zFile); |
| 510 | fossil_print("%s\n", zCmd); |
| 511 | if( fossil_system(zCmd) ){ |
| 512 | fossil_panic("editor aborted"); |
| 513 |