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.

jan.nijtmans 2017-03-06 12:35 trunk
Commit aa92dc8efe6d941a5a110e32048d06f42beb7ee6
3 files changed +2 -2 +3 -2 +4 -2
+2 -2
--- src/db.c
+++ src/db.c
@@ -1948,12 +1948,12 @@
19481948
db_open_repository(g.argv[2]);
19491949
db_open_config(0, 0);
19501950
if( zTemplate ) db_attach(zTemplate, "settingSrc");
19511951
db_begin_transaction();
19521952
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);
19551955
}
19561956
if( zDate==0 ) zDate = "now";
19571957
db_initial_setup(zTemplate, zDate, zDefaultUser);
19581958
db_end_transaction(0);
19591959
if( zTemplate ) db_detach("settingSrc");
19601960
--- 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 @@
162162
** Depending on the hash policy, the alternative hash may be disallowed.
163163
** If the alterative hash is disallowed, the routine returns 0. This
164164
** routine returns 1 if iHType>0 and the alternative hash is allowed,
165165
** and it always returns 1 when iHType==0.
166166
**
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.
169169
*/
170170
int hname_hash(const Blob *pContent, unsigned int iHType, Blob *pHashOut){
171171
assert( iHType==0 || iHType==1 );
172172
if( iHType==1 ){
173173
switch( g.eHashPolicy ){
174174
case HPOLICY_SHA1:
175
+ case HPOLICY_AUTO:
175176
sha3sum_blob(pContent, 256, pHashOut);
176177
return 1;
177178
case HPOLICY_SHA3:
178179
sha1sum_blob(pContent, pHashOut);
179180
return 1;
180181
--- 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 @@
140140
char *zLocalDbName; /* Name of the local database file */
141141
char *zOpenRevision; /* Check-in version to use during database open */
142142
int localOpen; /* True if the local database is open */
143143
char *zLocalRoot; /* The directory holding the local database */
144144
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_* */
146146
int fNoDirSymlinks; /* True if --no-dir-symlinks flag is present */
147147
int fSqlTrace; /* True if --sqltrace flag is present */
148148
int fSqlStats; /* True if --sqltrace or --sqlstats are present */
149149
int fSqlPrint; /* True if -sqlprint flag is present */
150150
int fQuiet; /* True if -quiet flag is present */
@@ -2006,11 +2006,11 @@
20062006
** the name of that directory and the specific repository will be
20072007
** opened later by process_one_web_page() based on the content of
20082008
** the PATH_INFO variable.
20092009
**
20102010
** 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.
20122012
*/
20132013
static void find_server_repository(int arg, int fCreate){
20142014
if( g.argc<=arg ){
20152015
db_must_be_within_tree();
20162016
}else{
@@ -2023,10 +2023,12 @@
20232023
if( isDir==0 && fCreate ){
20242024
const char *zPassword;
20252025
db_create_repository(zRepo);
20262026
db_open_repository(zRepo);
20272027
db_begin_transaction();
2028
+ g.eHashPolicy = HPOLICY_AUTO;
2029
+ db_set_int("hash-policy", HPOLICY_AUTO, 0);
20282030
db_initial_setup(0, "now", g.zLogin);
20292031
db_end_transaction(0);
20302032
fossil_print("project-id: %s\n", db_get("project-code", 0));
20312033
fossil_print("server-id: %s\n", db_get("server-code", 0));
20322034
zPassword = db_text(0, "SELECT pw FROM user WHERE login=%Q", g.zLogin);
20332035
--- 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

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button