Fossil SCM
For new Docker-generated repositories, use "auto" hash-policy as default: They might be synced with "sha1"-type repositories, this would render those repositories useless.
Commit
aa92dc8efe6d941a5a110e32048d06f42beb7ee6
Parent
907021af5104be6…
3 files changed
+2
-2
+3
-2
+4
-2
M
src/db.c
+2
-2
| --- src/db.c | ||
| +++ src/db.c | ||
| @@ -1948,12 +1948,12 @@ | ||
| 1948 | 1948 | db_open_repository(g.argv[2]); |
| 1949 | 1949 | db_open_config(0, 0); |
| 1950 | 1950 | if( zTemplate ) db_attach(zTemplate, "settingSrc"); |
| 1951 | 1951 | db_begin_transaction(); |
| 1952 | 1952 | if( bUseSha1 ){ |
| 1953 | - g.eHashPolicy = HPOLICY_SHA1; | |
| 1954 | - db_set_int("hash-policy", HPOLICY_SHA1, 0); | |
| 1953 | + g.eHashPolicy = HPOLICY_AUTO; | |
| 1954 | + db_set_int("hash-policy", HPOLICY_AUTO, 0); | |
| 1955 | 1955 | } |
| 1956 | 1956 | if( zDate==0 ) zDate = "now"; |
| 1957 | 1957 | db_initial_setup(zTemplate, zDate, zDefaultUser); |
| 1958 | 1958 | db_end_transaction(0); |
| 1959 | 1959 | if( zTemplate ) db_detach("settingSrc"); |
| 1960 | 1960 |
| --- src/db.c | |
| +++ src/db.c | |
| @@ -1948,12 +1948,12 @@ | |
| 1948 | db_open_repository(g.argv[2]); |
| 1949 | db_open_config(0, 0); |
| 1950 | if( zTemplate ) db_attach(zTemplate, "settingSrc"); |
| 1951 | db_begin_transaction(); |
| 1952 | if( bUseSha1 ){ |
| 1953 | g.eHashPolicy = HPOLICY_SHA1; |
| 1954 | db_set_int("hash-policy", HPOLICY_SHA1, 0); |
| 1955 | } |
| 1956 | if( zDate==0 ) zDate = "now"; |
| 1957 | db_initial_setup(zTemplate, zDate, zDefaultUser); |
| 1958 | db_end_transaction(0); |
| 1959 | if( zTemplate ) db_detach("settingSrc"); |
| 1960 |
| --- src/db.c | |
| +++ src/db.c | |
| @@ -1948,12 +1948,12 @@ | |
| 1948 | db_open_repository(g.argv[2]); |
| 1949 | db_open_config(0, 0); |
| 1950 | if( zTemplate ) db_attach(zTemplate, "settingSrc"); |
| 1951 | db_begin_transaction(); |
| 1952 | if( bUseSha1 ){ |
| 1953 | g.eHashPolicy = HPOLICY_AUTO; |
| 1954 | db_set_int("hash-policy", HPOLICY_AUTO, 0); |
| 1955 | } |
| 1956 | if( zDate==0 ) zDate = "now"; |
| 1957 | db_initial_setup(zTemplate, zDate, zDefaultUser); |
| 1958 | db_end_transaction(0); |
| 1959 | if( zTemplate ) db_detach("settingSrc"); |
| 1960 |
+3
-2
| --- src/hname.c | ||
| +++ src/hname.c | ||
| @@ -162,18 +162,19 @@ | ||
| 162 | 162 | ** Depending on the hash policy, the alternative hash may be disallowed. |
| 163 | 163 | ** If the alterative hash is disallowed, the routine returns 0. This |
| 164 | 164 | ** routine returns 1 if iHType>0 and the alternative hash is allowed, |
| 165 | 165 | ** and it always returns 1 when iHType==0. |
| 166 | 166 | ** |
| 167 | -** Alternative hash is disallowed for all hash policies except sha1 | |
| 168 | -** and sha3. | |
| 167 | +** Alternative hash is disallowed for all hash policies except auto, | |
| 168 | +** sha1 and sha3. | |
| 169 | 169 | */ |
| 170 | 170 | int hname_hash(const Blob *pContent, unsigned int iHType, Blob *pHashOut){ |
| 171 | 171 | assert( iHType==0 || iHType==1 ); |
| 172 | 172 | if( iHType==1 ){ |
| 173 | 173 | switch( g.eHashPolicy ){ |
| 174 | 174 | case HPOLICY_SHA1: |
| 175 | + case HPOLICY_AUTO: | |
| 175 | 176 | sha3sum_blob(pContent, 256, pHashOut); |
| 176 | 177 | return 1; |
| 177 | 178 | case HPOLICY_SHA3: |
| 178 | 179 | sha1sum_blob(pContent, pHashOut); |
| 179 | 180 | return 1; |
| 180 | 181 |
| --- src/hname.c | |
| +++ src/hname.c | |
| @@ -162,18 +162,19 @@ | |
| 162 | ** Depending on the hash policy, the alternative hash may be disallowed. |
| 163 | ** If the alterative hash is disallowed, the routine returns 0. This |
| 164 | ** routine returns 1 if iHType>0 and the alternative hash is allowed, |
| 165 | ** and it always returns 1 when iHType==0. |
| 166 | ** |
| 167 | ** Alternative hash is disallowed for all hash policies except sha1 |
| 168 | ** and sha3. |
| 169 | */ |
| 170 | int hname_hash(const Blob *pContent, unsigned int iHType, Blob *pHashOut){ |
| 171 | assert( iHType==0 || iHType==1 ); |
| 172 | if( iHType==1 ){ |
| 173 | switch( g.eHashPolicy ){ |
| 174 | case HPOLICY_SHA1: |
| 175 | sha3sum_blob(pContent, 256, pHashOut); |
| 176 | return 1; |
| 177 | case HPOLICY_SHA3: |
| 178 | sha1sum_blob(pContent, pHashOut); |
| 179 | return 1; |
| 180 |
| --- src/hname.c | |
| +++ src/hname.c | |
| @@ -162,18 +162,19 @@ | |
| 162 | ** Depending on the hash policy, the alternative hash may be disallowed. |
| 163 | ** If the alterative hash is disallowed, the routine returns 0. This |
| 164 | ** routine returns 1 if iHType>0 and the alternative hash is allowed, |
| 165 | ** and it always returns 1 when iHType==0. |
| 166 | ** |
| 167 | ** Alternative hash is disallowed for all hash policies except auto, |
| 168 | ** sha1 and sha3. |
| 169 | */ |
| 170 | int hname_hash(const Blob *pContent, unsigned int iHType, Blob *pHashOut){ |
| 171 | assert( iHType==0 || iHType==1 ); |
| 172 | if( iHType==1 ){ |
| 173 | switch( g.eHashPolicy ){ |
| 174 | case HPOLICY_SHA1: |
| 175 | case HPOLICY_AUTO: |
| 176 | sha3sum_blob(pContent, 256, pHashOut); |
| 177 | return 1; |
| 178 | case HPOLICY_SHA3: |
| 179 | sha1sum_blob(pContent, pHashOut); |
| 180 | return 1; |
| 181 |
+4
-2
| --- src/main.c | ||
| +++ src/main.c | ||
| @@ -140,11 +140,11 @@ | ||
| 140 | 140 | char *zLocalDbName; /* Name of the local database file */ |
| 141 | 141 | char *zOpenRevision; /* Check-in version to use during database open */ |
| 142 | 142 | int localOpen; /* True if the local database is open */ |
| 143 | 143 | char *zLocalRoot; /* The directory holding the local database */ |
| 144 | 144 | int minPrefix; /* Number of digits needed for a distinct UUID */ |
| 145 | - int eHashPolicy; /* Current hash policy. On of HPOLICY_* */ | |
| 145 | + int eHashPolicy; /* Current hash policy. One of HPOLICY_* */ | |
| 146 | 146 | int fNoDirSymlinks; /* True if --no-dir-symlinks flag is present */ |
| 147 | 147 | int fSqlTrace; /* True if --sqltrace flag is present */ |
| 148 | 148 | int fSqlStats; /* True if --sqltrace or --sqlstats are present */ |
| 149 | 149 | int fSqlPrint; /* True if -sqlprint flag is present */ |
| 150 | 150 | int fQuiet; /* True if -quiet flag is present */ |
| @@ -2006,11 +2006,11 @@ | ||
| 2006 | 2006 | ** the name of that directory and the specific repository will be |
| 2007 | 2007 | ** opened later by process_one_web_page() based on the content of |
| 2008 | 2008 | ** the PATH_INFO variable. |
| 2009 | 2009 | ** |
| 2010 | 2010 | ** If the fCreate flag is set, then create the repository if it |
| 2011 | -** does not already exist. | |
| 2011 | +** does not already exist. Always use "auto" hash-policy in this case. | |
| 2012 | 2012 | */ |
| 2013 | 2013 | static void find_server_repository(int arg, int fCreate){ |
| 2014 | 2014 | if( g.argc<=arg ){ |
| 2015 | 2015 | db_must_be_within_tree(); |
| 2016 | 2016 | }else{ |
| @@ -2023,10 +2023,12 @@ | ||
| 2023 | 2023 | if( isDir==0 && fCreate ){ |
| 2024 | 2024 | const char *zPassword; |
| 2025 | 2025 | db_create_repository(zRepo); |
| 2026 | 2026 | db_open_repository(zRepo); |
| 2027 | 2027 | db_begin_transaction(); |
| 2028 | + g.eHashPolicy = HPOLICY_AUTO; | |
| 2029 | + db_set_int("hash-policy", HPOLICY_AUTO, 0); | |
| 2028 | 2030 | db_initial_setup(0, "now", g.zLogin); |
| 2029 | 2031 | db_end_transaction(0); |
| 2030 | 2032 | fossil_print("project-id: %s\n", db_get("project-code", 0)); |
| 2031 | 2033 | fossil_print("server-id: %s\n", db_get("server-code", 0)); |
| 2032 | 2034 | zPassword = db_text(0, "SELECT pw FROM user WHERE login=%Q", g.zLogin); |
| 2033 | 2035 |
| --- src/main.c | |
| +++ src/main.c | |
| @@ -140,11 +140,11 @@ | |
| 140 | char *zLocalDbName; /* Name of the local database file */ |
| 141 | char *zOpenRevision; /* Check-in version to use during database open */ |
| 142 | int localOpen; /* True if the local database is open */ |
| 143 | char *zLocalRoot; /* The directory holding the local database */ |
| 144 | int minPrefix; /* Number of digits needed for a distinct UUID */ |
| 145 | int eHashPolicy; /* Current hash policy. On of HPOLICY_* */ |
| 146 | int fNoDirSymlinks; /* True if --no-dir-symlinks flag is present */ |
| 147 | int fSqlTrace; /* True if --sqltrace flag is present */ |
| 148 | int fSqlStats; /* True if --sqltrace or --sqlstats are present */ |
| 149 | int fSqlPrint; /* True if -sqlprint flag is present */ |
| 150 | int fQuiet; /* True if -quiet flag is present */ |
| @@ -2006,11 +2006,11 @@ | |
| 2006 | ** the name of that directory and the specific repository will be |
| 2007 | ** opened later by process_one_web_page() based on the content of |
| 2008 | ** the PATH_INFO variable. |
| 2009 | ** |
| 2010 | ** If the fCreate flag is set, then create the repository if it |
| 2011 | ** does not already exist. |
| 2012 | */ |
| 2013 | static void find_server_repository(int arg, int fCreate){ |
| 2014 | if( g.argc<=arg ){ |
| 2015 | db_must_be_within_tree(); |
| 2016 | }else{ |
| @@ -2023,10 +2023,12 @@ | |
| 2023 | if( isDir==0 && fCreate ){ |
| 2024 | const char *zPassword; |
| 2025 | db_create_repository(zRepo); |
| 2026 | db_open_repository(zRepo); |
| 2027 | db_begin_transaction(); |
| 2028 | db_initial_setup(0, "now", g.zLogin); |
| 2029 | db_end_transaction(0); |
| 2030 | fossil_print("project-id: %s\n", db_get("project-code", 0)); |
| 2031 | fossil_print("server-id: %s\n", db_get("server-code", 0)); |
| 2032 | zPassword = db_text(0, "SELECT pw FROM user WHERE login=%Q", g.zLogin); |
| 2033 |
| --- src/main.c | |
| +++ src/main.c | |
| @@ -140,11 +140,11 @@ | |
| 140 | char *zLocalDbName; /* Name of the local database file */ |
| 141 | char *zOpenRevision; /* Check-in version to use during database open */ |
| 142 | int localOpen; /* True if the local database is open */ |
| 143 | char *zLocalRoot; /* The directory holding the local database */ |
| 144 | int minPrefix; /* Number of digits needed for a distinct UUID */ |
| 145 | int eHashPolicy; /* Current hash policy. One of HPOLICY_* */ |
| 146 | int fNoDirSymlinks; /* True if --no-dir-symlinks flag is present */ |
| 147 | int fSqlTrace; /* True if --sqltrace flag is present */ |
| 148 | int fSqlStats; /* True if --sqltrace or --sqlstats are present */ |
| 149 | int fSqlPrint; /* True if -sqlprint flag is present */ |
| 150 | int fQuiet; /* True if -quiet flag is present */ |
| @@ -2006,11 +2006,11 @@ | |
| 2006 | ** the name of that directory and the specific repository will be |
| 2007 | ** opened later by process_one_web_page() based on the content of |
| 2008 | ** the PATH_INFO variable. |
| 2009 | ** |
| 2010 | ** If the fCreate flag is set, then create the repository if it |
| 2011 | ** does not already exist. Always use "auto" hash-policy in this case. |
| 2012 | */ |
| 2013 | static void find_server_repository(int arg, int fCreate){ |
| 2014 | if( g.argc<=arg ){ |
| 2015 | db_must_be_within_tree(); |
| 2016 | }else{ |
| @@ -2023,10 +2023,12 @@ | |
| 2023 | if( isDir==0 && fCreate ){ |
| 2024 | const char *zPassword; |
| 2025 | db_create_repository(zRepo); |
| 2026 | db_open_repository(zRepo); |
| 2027 | db_begin_transaction(); |
| 2028 | g.eHashPolicy = HPOLICY_AUTO; |
| 2029 | db_set_int("hash-policy", HPOLICY_AUTO, 0); |
| 2030 | db_initial_setup(0, "now", g.zLogin); |
| 2031 | db_end_transaction(0); |
| 2032 | fossil_print("project-id: %s\n", db_get("project-code", 0)); |
| 2033 | fossil_print("server-id: %s\n", db_get("server-code", 0)); |
| 2034 | zPassword = db_text(0, "SELECT pw FROM user WHERE login=%Q", g.zLogin); |
| 2035 |