Fossil SCM
Disable the check of the "server-code" on a sync. This means that two repositories with the same "server-code" can sync with each other, which allows a repository to be copied using an ordinary file copy, and without having to run clone.
Commit
469efd6a7ce8ba441b7c7a558f15e3f7ab5847e4
Parent
c83c1110f696bed…
1 file changed
+11
-1
+11
-1
| --- src/xfer.c | ||
| +++ src/xfer.c | ||
| @@ -658,13 +658,21 @@ | ||
| 658 | 658 | if( xfer.nToken==3 |
| 659 | 659 | && (blob_eq(&xfer.aToken[0], "pull") || blob_eq(&xfer.aToken[0], "push")) |
| 660 | 660 | && blob_is_uuid(&xfer.aToken[1]) |
| 661 | 661 | && blob_is_uuid(&xfer.aToken[2]) |
| 662 | 662 | ){ |
| 663 | - const char *zSCode; | |
| 664 | 663 | const char *zPCode; |
| 665 | 664 | |
| 665 | +#if 0 | |
| 666 | + /* This block checks to see if a server is trying to sync with itself. | |
| 667 | + ** This used to be disallowed, but I cannot think of any significant | |
| 668 | + ** harm, so I have disabled the check. | |
| 669 | + ** | |
| 670 | + ** With this check disabled, it is sufficient to copy the repository | |
| 671 | + ** database. No need to run clone. | |
| 672 | + */ | |
| 673 | + const char *zSCode; | |
| 666 | 674 | zSCode = db_get("server-code", 0); |
| 667 | 675 | if( zSCode==0 ){ |
| 668 | 676 | fossil_panic("missing server code"); |
| 669 | 677 | } |
| 670 | 678 | if( blob_eq_str(&xfer.aToken[1], zSCode, -1) ){ |
| @@ -671,10 +679,12 @@ | ||
| 671 | 679 | cgi_reset_content(); |
| 672 | 680 | @ error server\sloop |
| 673 | 681 | nErr++; |
| 674 | 682 | break; |
| 675 | 683 | } |
| 684 | +#endif | |
| 685 | + | |
| 676 | 686 | zPCode = db_get("project-code", 0); |
| 677 | 687 | if( zPCode==0 ){ |
| 678 | 688 | fossil_panic("missing project code"); |
| 679 | 689 | } |
| 680 | 690 | if( !blob_eq_str(&xfer.aToken[2], zPCode, -1) ){ |
| 681 | 691 |
| --- src/xfer.c | |
| +++ src/xfer.c | |
| @@ -658,13 +658,21 @@ | |
| 658 | if( xfer.nToken==3 |
| 659 | && (blob_eq(&xfer.aToken[0], "pull") || blob_eq(&xfer.aToken[0], "push")) |
| 660 | && blob_is_uuid(&xfer.aToken[1]) |
| 661 | && blob_is_uuid(&xfer.aToken[2]) |
| 662 | ){ |
| 663 | const char *zSCode; |
| 664 | const char *zPCode; |
| 665 | |
| 666 | zSCode = db_get("server-code", 0); |
| 667 | if( zSCode==0 ){ |
| 668 | fossil_panic("missing server code"); |
| 669 | } |
| 670 | if( blob_eq_str(&xfer.aToken[1], zSCode, -1) ){ |
| @@ -671,10 +679,12 @@ | |
| 671 | cgi_reset_content(); |
| 672 | @ error server\sloop |
| 673 | nErr++; |
| 674 | break; |
| 675 | } |
| 676 | zPCode = db_get("project-code", 0); |
| 677 | if( zPCode==0 ){ |
| 678 | fossil_panic("missing project code"); |
| 679 | } |
| 680 | if( !blob_eq_str(&xfer.aToken[2], zPCode, -1) ){ |
| 681 |
| --- src/xfer.c | |
| +++ src/xfer.c | |
| @@ -658,13 +658,21 @@ | |
| 658 | if( xfer.nToken==3 |
| 659 | && (blob_eq(&xfer.aToken[0], "pull") || blob_eq(&xfer.aToken[0], "push")) |
| 660 | && blob_is_uuid(&xfer.aToken[1]) |
| 661 | && blob_is_uuid(&xfer.aToken[2]) |
| 662 | ){ |
| 663 | const char *zPCode; |
| 664 | |
| 665 | #if 0 |
| 666 | /* This block checks to see if a server is trying to sync with itself. |
| 667 | ** This used to be disallowed, but I cannot think of any significant |
| 668 | ** harm, so I have disabled the check. |
| 669 | ** |
| 670 | ** With this check disabled, it is sufficient to copy the repository |
| 671 | ** database. No need to run clone. |
| 672 | */ |
| 673 | const char *zSCode; |
| 674 | zSCode = db_get("server-code", 0); |
| 675 | if( zSCode==0 ){ |
| 676 | fossil_panic("missing server code"); |
| 677 | } |
| 678 | if( blob_eq_str(&xfer.aToken[1], zSCode, -1) ){ |
| @@ -671,10 +679,12 @@ | |
| 679 | cgi_reset_content(); |
| 680 | @ error server\sloop |
| 681 | nErr++; |
| 682 | break; |
| 683 | } |
| 684 | #endif |
| 685 | |
| 686 | zPCode = db_get("project-code", 0); |
| 687 | if( zPCode==0 ){ |
| 688 | fossil_panic("missing project code"); |
| 689 | } |
| 690 | if( !blob_eq_str(&xfer.aToken[2], zPCode, -1) ){ |
| 691 |