Fossil

Check-in [d9b3a863]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Preserve the hash policy on a clone.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | fossil-2.1
Files: files | file ages | folders
SHA1: d9b3a863efa37817e9b05e02966dea0f62a76e60
User & Date: drh 2017-03-04 21:03:17
Context
2017-03-05
00:08
Add the --sha1 option to the "fossil new" command, to simplify the creation of new SHA1-only repositories. check-in: 91f5ad9b user: drh tags: fossil-2.1
2017-03-04
21:03
Preserve the hash policy on a clone. check-in: d9b3a863 user: drh tags: fossil-2.1
20:38
New repositories default to hash policy "shun-sha1" with a SHA3 initial check-in. But this can be overridden using the --template option with a template repository that is already set to a different hash policy. check-in: 95543ce4 user: drh tags: fossil-2.1
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to src/clone.c.

173
174
175
176
177
178
179

180
181
182
183
184
185
186
    db_begin_transaction();
    db_record_repository_filename(g.argv[3]);
    db_initial_setup(0, 0, zDefaultUser);
    user_select();
    db_set("content-schema", CONTENT_SCHEMA, 0);
    db_set("aux-schema", AUX_SCHEMA_MAX, 0);
    db_set("rebuilt", get_version(), 0);

    remember_or_get_http_auth(zHttpAuth, urlFlags & URL_REMEMBER, g.argv[2]);
    url_remember();
    if( g.zSSLIdentity!=0 ){
      /* If the --ssl-identity option was specified, store it as a setting */
      Blob fn;
      blob_zero(&fn);
      file_canonical_name(g.zSSLIdentity, &fn, 0);







>







173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
    db_begin_transaction();
    db_record_repository_filename(g.argv[3]);
    db_initial_setup(0, 0, zDefaultUser);
    user_select();
    db_set("content-schema", CONTENT_SCHEMA, 0);
    db_set("aux-schema", AUX_SCHEMA_MAX, 0);
    db_set("rebuilt", get_version(), 0);
    db_unset("hash-policy", 0);
    remember_or_get_http_auth(zHttpAuth, urlFlags & URL_REMEMBER, g.argv[2]);
    url_remember();
    if( g.zSSLIdentity!=0 ){
      /* If the --ssl-identity option was specified, store it as a setting */
      Blob fn;
      blob_zero(&fn);
      file_canonical_name(g.zSSLIdentity, &fn, 0);

Changes to src/hname.c.

196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211

212
213
214
215
216
217
218
219
220
221
  return 0;
}

/*
** Return the default hash policy for repositories that do not currently
** have an assigned hash policy.
**
** Make the default HPOLICY_AUTO if there are SHA1 artficats but no SHA3
** artifacts in the repository.  Make the default HPOLICY_SHA3 if there 
** are one or more SHA3 artifacts.  Make the default policy HPOLICY_SHUN_SHA1
** if the repository contains no artifact at all.
*/
int hname_default_policy(void){
  if( db_exists("SELECT 1 FROM blob WHERE length(uuid)>40") ){
    return HPOLICY_SHA3;
  }else if( db_exists("SELECT 1 FROM blob WHERE length(uuid)==40") ){

    return HPOLICY_AUTO;
  }else{
    return HPOLICY_SHUN_SHA1;
  }
}

/*
** COMMAND: hash-policy*
**
** Usage: fossil hash-policy ?NEW-POLICY?







|

|
<


|
<
|
>
|

|







196
197
198
199
200
201
202
203
204
205

206
207
208

209
210
211
212
213
214
215
216
217
218
219
220
  return 0;
}

/*
** Return the default hash policy for repositories that do not currently
** have an assigned hash policy.
**
** Make the default HPOLICY_AUTO if there are SHA1 artficates but no SHA3
** artifacts in the repository.  Make the default HPOLICY_SHA3 if there 
** are one or more SHA3 artifacts or if the repository is initially empty.

*/
int hname_default_policy(void){
  if( db_exists("SELECT 1 FROM blob WHERE length(uuid)>40") 

   || !db_exists("SELECT 1 FROM blob WHERE length(uuid)==40")
  ){
    return HPOLICY_SHA3;
  }else{
    return HPOLICY_AUTO;
  }
}

/*
** COMMAND: hash-policy*
**
** Usage: fossil hash-policy ?NEW-POLICY?