Fossil SCM
For sync, the client should only send "pragma client-url" if not doing a cross-project import.
Commit
b330ce6cfb817d77424df5ceb7529f44c5696185133e2e89c2204486684d62e0
Parent
84358b7db1bfe5d…
1 file changed
+23
-4
+23
-4
| --- src/xfer.c | ||
| +++ src/xfer.c | ||
| @@ -1917,21 +1917,40 @@ | ||
| 1917 | 1917 | const char *zClientId; /* A unique identifier for this check-out */ |
| 1918 | 1918 | unsigned int mHttpFlags;/* Flags for the http_exchange() subsystem */ |
| 1919 | 1919 | |
| 1920 | 1920 | if( db_get_boolean("dont-push", 0) ) syncFlags &= ~SYNC_PUSH; |
| 1921 | 1921 | if( (syncFlags & (SYNC_PUSH|SYNC_PULL|SYNC_CLONE|SYNC_UNVERSIONED))==0 |
| 1922 | - && configRcvMask==0 && configSendMask==0 ) return 0; | |
| 1922 | + && configRcvMask==0 | |
| 1923 | + && configSendMask==0 | |
| 1924 | + ){ | |
| 1925 | + return 0; /* Nothing to do */ | |
| 1926 | + } | |
| 1927 | + | |
| 1928 | + /* Compute an appropriate project code. zPCode is the project code | |
| 1929 | + ** for the local repository. zAltPCode will usually be NULL, but might | |
| 1930 | + ** also be an alternative project code to expect on the server. When | |
| 1931 | + ** zAltPCode is not NULL, that means we are doing a cross-project import - | |
| 1932 | + ** in other words, reading content from one project into a different | |
| 1933 | + ** project. | |
| 1934 | + */ | |
| 1923 | 1935 | if( syncFlags & SYNC_FROMPARENT ){ |
| 1936 | + const char *zPX; | |
| 1924 | 1937 | configRcvMask = 0; |
| 1925 | 1938 | configSendMask = 0; |
| 1926 | 1939 | syncFlags &= ~(SYNC_PUSH); |
| 1927 | - zPCode = db_get("parent-project-code", 0); | |
| 1928 | - if( zPCode==0 || db_get("parent-project-name",0)==0 ){ | |
| 1940 | + zPX = db_get("parent-project-code", 0); | |
| 1941 | + if( zPX==0 || db_get("parent-project-name",0)==0 ){ | |
| 1929 | 1942 | fossil_fatal("there is no parent project: set the 'parent-project-code'" |
| 1930 | 1943 | " and 'parent-project-name' config parameters in order" |
| 1931 | 1944 | " to pull from a parent project"); |
| 1932 | 1945 | } |
| 1946 | + if( zPX ){ | |
| 1947 | + zAltPCode = zPX; | |
| 1948 | + } | |
| 1949 | + } | |
| 1950 | + if( zAltPCode!=0 && zPCode!=0 && sqlite3_stricmp(zPCode, zAltPCode)==0 ){ | |
| 1951 | + zAltPCode = 0; | |
| 1933 | 1952 | } |
| 1934 | 1953 | |
| 1935 | 1954 | transport_stats(0, 0, 1); |
| 1936 | 1955 | socket_global_init(); |
| 1937 | 1956 | memset(&xfer, 0, sizeof(xfer)); |
| @@ -2183,11 +2202,11 @@ | ||
| 2183 | 2202 | } |
| 2184 | 2203 | |
| 2185 | 2204 | /* Send the client-url pragma on the first cycle if the client has |
| 2186 | 2205 | ** a known public url. |
| 2187 | 2206 | */ |
| 2188 | - if( nCycle==0 ){ | |
| 2207 | + if( nCycle==0 && zAltPCode==0 ){ | |
| 2189 | 2208 | const char *zSelfUrl = public_url(); |
| 2190 | 2209 | if( zSelfUrl ){ |
| 2191 | 2210 | blob_appendf(&send, "pragma client-url %s\n", zSelfUrl); |
| 2192 | 2211 | } |
| 2193 | 2212 | } |
| 2194 | 2213 |
| --- src/xfer.c | |
| +++ src/xfer.c | |
| @@ -1917,21 +1917,40 @@ | |
| 1917 | const char *zClientId; /* A unique identifier for this check-out */ |
| 1918 | unsigned int mHttpFlags;/* Flags for the http_exchange() subsystem */ |
| 1919 | |
| 1920 | if( db_get_boolean("dont-push", 0) ) syncFlags &= ~SYNC_PUSH; |
| 1921 | if( (syncFlags & (SYNC_PUSH|SYNC_PULL|SYNC_CLONE|SYNC_UNVERSIONED))==0 |
| 1922 | && configRcvMask==0 && configSendMask==0 ) return 0; |
| 1923 | if( syncFlags & SYNC_FROMPARENT ){ |
| 1924 | configRcvMask = 0; |
| 1925 | configSendMask = 0; |
| 1926 | syncFlags &= ~(SYNC_PUSH); |
| 1927 | zPCode = db_get("parent-project-code", 0); |
| 1928 | if( zPCode==0 || db_get("parent-project-name",0)==0 ){ |
| 1929 | fossil_fatal("there is no parent project: set the 'parent-project-code'" |
| 1930 | " and 'parent-project-name' config parameters in order" |
| 1931 | " to pull from a parent project"); |
| 1932 | } |
| 1933 | } |
| 1934 | |
| 1935 | transport_stats(0, 0, 1); |
| 1936 | socket_global_init(); |
| 1937 | memset(&xfer, 0, sizeof(xfer)); |
| @@ -2183,11 +2202,11 @@ | |
| 2183 | } |
| 2184 | |
| 2185 | /* Send the client-url pragma on the first cycle if the client has |
| 2186 | ** a known public url. |
| 2187 | */ |
| 2188 | if( nCycle==0 ){ |
| 2189 | const char *zSelfUrl = public_url(); |
| 2190 | if( zSelfUrl ){ |
| 2191 | blob_appendf(&send, "pragma client-url %s\n", zSelfUrl); |
| 2192 | } |
| 2193 | } |
| 2194 |
| --- src/xfer.c | |
| +++ src/xfer.c | |
| @@ -1917,21 +1917,40 @@ | |
| 1917 | const char *zClientId; /* A unique identifier for this check-out */ |
| 1918 | unsigned int mHttpFlags;/* Flags for the http_exchange() subsystem */ |
| 1919 | |
| 1920 | if( db_get_boolean("dont-push", 0) ) syncFlags &= ~SYNC_PUSH; |
| 1921 | if( (syncFlags & (SYNC_PUSH|SYNC_PULL|SYNC_CLONE|SYNC_UNVERSIONED))==0 |
| 1922 | && configRcvMask==0 |
| 1923 | && configSendMask==0 |
| 1924 | ){ |
| 1925 | return 0; /* Nothing to do */ |
| 1926 | } |
| 1927 | |
| 1928 | /* Compute an appropriate project code. zPCode is the project code |
| 1929 | ** for the local repository. zAltPCode will usually be NULL, but might |
| 1930 | ** also be an alternative project code to expect on the server. When |
| 1931 | ** zAltPCode is not NULL, that means we are doing a cross-project import - |
| 1932 | ** in other words, reading content from one project into a different |
| 1933 | ** project. |
| 1934 | */ |
| 1935 | if( syncFlags & SYNC_FROMPARENT ){ |
| 1936 | const char *zPX; |
| 1937 | configRcvMask = 0; |
| 1938 | configSendMask = 0; |
| 1939 | syncFlags &= ~(SYNC_PUSH); |
| 1940 | zPX = db_get("parent-project-code", 0); |
| 1941 | if( zPX==0 || db_get("parent-project-name",0)==0 ){ |
| 1942 | fossil_fatal("there is no parent project: set the 'parent-project-code'" |
| 1943 | " and 'parent-project-name' config parameters in order" |
| 1944 | " to pull from a parent project"); |
| 1945 | } |
| 1946 | if( zPX ){ |
| 1947 | zAltPCode = zPX; |
| 1948 | } |
| 1949 | } |
| 1950 | if( zAltPCode!=0 && zPCode!=0 && sqlite3_stricmp(zPCode, zAltPCode)==0 ){ |
| 1951 | zAltPCode = 0; |
| 1952 | } |
| 1953 | |
| 1954 | transport_stats(0, 0, 1); |
| 1955 | socket_global_init(); |
| 1956 | memset(&xfer, 0, sizeof(xfer)); |
| @@ -2183,11 +2202,11 @@ | |
| 2202 | } |
| 2203 | |
| 2204 | /* Send the client-url pragma on the first cycle if the client has |
| 2205 | ** a known public url. |
| 2206 | */ |
| 2207 | if( nCycle==0 && zAltPCode==0 ){ |
| 2208 | const char *zSelfUrl = public_url(); |
| 2209 | if( zSelfUrl ){ |
| 2210 | blob_appendf(&send, "pragma client-url %s\n", zSelfUrl); |
| 2211 | } |
| 2212 | } |
| 2213 |