Fossil SCM

Preserve the hash policy on a clone.

drh 2017-03-04 21:03 fossil-2.1
Commit d9b3a863efa37817e9b05e02966dea0f62a76e60
2 files changed +1 +6 -7
--- src/clone.c
+++ src/clone.c
@@ -175,10 +175,11 @@
175175
db_initial_setup(0, 0, zDefaultUser);
176176
user_select();
177177
db_set("content-schema", CONTENT_SCHEMA, 0);
178178
db_set("aux-schema", AUX_SCHEMA_MAX, 0);
179179
db_set("rebuilt", get_version(), 0);
180
+ db_unset("hash-policy", 0);
180181
remember_or_get_http_auth(zHttpAuth, urlFlags & URL_REMEMBER, g.argv[2]);
181182
url_remember();
182183
if( g.zSSLIdentity!=0 ){
183184
/* If the --ssl-identity option was specified, store it as a setting */
184185
Blob fn;
185186
--- src/clone.c
+++ src/clone.c
@@ -175,10 +175,11 @@
175 db_initial_setup(0, 0, zDefaultUser);
176 user_select();
177 db_set("content-schema", CONTENT_SCHEMA, 0);
178 db_set("aux-schema", AUX_SCHEMA_MAX, 0);
179 db_set("rebuilt", get_version(), 0);
 
180 remember_or_get_http_auth(zHttpAuth, urlFlags & URL_REMEMBER, g.argv[2]);
181 url_remember();
182 if( g.zSSLIdentity!=0 ){
183 /* If the --ssl-identity option was specified, store it as a setting */
184 Blob fn;
185
--- src/clone.c
+++ src/clone.c
@@ -175,10 +175,11 @@
175 db_initial_setup(0, 0, zDefaultUser);
176 user_select();
177 db_set("content-schema", CONTENT_SCHEMA, 0);
178 db_set("aux-schema", AUX_SCHEMA_MAX, 0);
179 db_set("rebuilt", get_version(), 0);
180 db_unset("hash-policy", 0);
181 remember_or_get_http_auth(zHttpAuth, urlFlags & URL_REMEMBER, g.argv[2]);
182 url_remember();
183 if( g.zSSLIdentity!=0 ){
184 /* If the --ssl-identity option was specified, store it as a setting */
185 Blob fn;
186
+6 -7
--- src/hname.c
+++ src/hname.c
@@ -198,22 +198,21 @@
198198
199199
/*
200200
** Return the default hash policy for repositories that do not currently
201201
** have an assigned hash policy.
202202
**
203
-** Make the default HPOLICY_AUTO if there are SHA1 artficats but no SHA3
203
+** Make the default HPOLICY_AUTO if there are SHA1 artficates but no SHA3
204204
** artifacts in the repository. Make the default HPOLICY_SHA3 if there
205
-** are one or more SHA3 artifacts. Make the default policy HPOLICY_SHUN_SHA1
206
-** if the repository contains no artifact at all.
205
+** are one or more SHA3 artifacts or if the repository is initially empty.
207206
*/
208207
int hname_default_policy(void){
209
- if( db_exists("SELECT 1 FROM blob WHERE length(uuid)>40") ){
208
+ if( db_exists("SELECT 1 FROM blob WHERE length(uuid)>40")
209
+ || !db_exists("SELECT 1 FROM blob WHERE length(uuid)==40")
210
+ ){
210211
return HPOLICY_SHA3;
211
- }else if( db_exists("SELECT 1 FROM blob WHERE length(uuid)==40") ){
212
- return HPOLICY_AUTO;
213212
}else{
214
- return HPOLICY_SHUN_SHA1;
213
+ return HPOLICY_AUTO;
215214
}
216215
}
217216
218217
/*
219218
** COMMAND: hash-policy*
220219
--- src/hname.c
+++ src/hname.c
@@ -198,22 +198,21 @@
198
199 /*
200 ** Return the default hash policy for repositories that do not currently
201 ** have an assigned hash policy.
202 **
203 ** Make the default HPOLICY_AUTO if there are SHA1 artficats but no SHA3
204 ** artifacts in the repository. Make the default HPOLICY_SHA3 if there
205 ** are one or more SHA3 artifacts. Make the default policy HPOLICY_SHUN_SHA1
206 ** if the repository contains no artifact at all.
207 */
208 int hname_default_policy(void){
209 if( db_exists("SELECT 1 FROM blob WHERE length(uuid)>40") ){
 
 
210 return HPOLICY_SHA3;
211 }else if( db_exists("SELECT 1 FROM blob WHERE length(uuid)==40") ){
212 return HPOLICY_AUTO;
213 }else{
214 return HPOLICY_SHUN_SHA1;
215 }
216 }
217
218 /*
219 ** COMMAND: hash-policy*
220
--- src/hname.c
+++ src/hname.c
@@ -198,22 +198,21 @@
198
199 /*
200 ** Return the default hash policy for repositories that do not currently
201 ** have an assigned hash policy.
202 **
203 ** Make the default HPOLICY_AUTO if there are SHA1 artficates but no SHA3
204 ** artifacts in the repository. Make the default HPOLICY_SHA3 if there
205 ** are one or more SHA3 artifacts or if the repository is initially empty.
 
206 */
207 int hname_default_policy(void){
208 if( db_exists("SELECT 1 FROM blob WHERE length(uuid)>40")
209 || !db_exists("SELECT 1 FROM blob WHERE length(uuid)==40")
210 ){
211 return HPOLICY_SHA3;
 
 
212 }else{
213 return HPOLICY_AUTO;
214 }
215 }
216
217 /*
218 ** COMMAND: hash-policy*
219

Keyboard Shortcuts

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