Fossil

Check-in [5cf5ad84]
Login

Check-in [5cf5ad84]

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

Overview
Comment:The /file page for a file that is not part of the latest checkin tries to substitute the most recent checking that added the file.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 5cf5ad8491c97b09aa992135bbf20c0e8f5aa0f1f3d03a02ad76e379928e9bd3
User & Date: drh 2020-10-20 23:37:29
Context
2020-10-20
23:40
Fix a harmless compiler warning in the previous check-in. ... (check-in: 6c2b5baf user: drh tags: trunk)
23:37
The /file page for a file that is not part of the latest checkin tries to substitute the most recent checking that added the file. ... (check-in: 5cf5ad84 user: drh tags: trunk)
10:08
Small tweaks to the CAP Theorem doc ... (check-in: 67a4c1d3 user: wyoung tags: trunk)
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to src/info.c.

2282
2283
2284
2285
2286
2287
2288

2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301


















2302
2303

2304
2305
2306
2307

2308
2309

2310
2311
2312
2313
2314
2315
2316
  }
  if( rid==0 ){
    rid = artifact_from_ci_and_filename(0);
  }

  if( rid==0 ){  /* Artifact not found */
    if( isFile ){

      /* For /file, also check to see if name= refers to a directory,
      ** and if so, do a listing for that directory */
      int nName = (int)strlen(zName);
      if( nName && zName[nName-1]=='/' ) nName--;
      if( db_exists(
         "SELECT 1 FROM filename"
         " WHERE name GLOB '%.*q/*' AND substr(name,1,%d)=='%.*q/';",
         nName, zName, nName+1, nName, zName
      ) ){
        if( P("ci")==0 ) cgi_set_query_parameter("ci","tip");
        page_tree();
        return;
      }


















      style_header("No such file");
      @ File '%h(zName)' does not exist in this repository.

    }else{
      style_header("No such artifact");
      @ Artifact '%h(zName)' does not exist in this repository.
    }

    style_footer();
    return;

  }

  if( descOnly || P("verbose")!=0 ){
    url_add_parameter(&url, "verbose", "1");
    objdescFlags |= OBJDESC_DETAIL;
  }
  zUuid = db_text("?", "SELECT uuid FROM blob WHERE rid=%d", rid);







>













>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
|
|
>




>
|
|
>







2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
  }
  if( rid==0 ){
    rid = artifact_from_ci_and_filename(0);
  }

  if( rid==0 ){  /* Artifact not found */
    if( isFile ){
      Stmt q;
      /* For /file, also check to see if name= refers to a directory,
      ** and if so, do a listing for that directory */
      int nName = (int)strlen(zName);
      if( nName && zName[nName-1]=='/' ) nName--;
      if( db_exists(
         "SELECT 1 FROM filename"
         " WHERE name GLOB '%.*q/*' AND substr(name,1,%d)=='%.*q/';",
         nName, zName, nName+1, nName, zName
      ) ){
        if( P("ci")==0 ) cgi_set_query_parameter("ci","tip");
        page_tree();
        return;
      }
      /* No directory found, look for an historic version of the file
      ** that was subsequently deleted. */
      db_prepare(&q, 
        "SELECT fid, uuid FROM mlink, filename, event, blob"
        " WHERE filename.name=%Q"
        "   AND mlink.fnid=filename.fnid AND mlink.fid>0"
        "   AND event.objid=mlink.mid"
        "   AND blob.rid=mlink.mid"
        " ORDER BY event.mtime DESC",
        zName
      );
      if( db_step(&q)==SQLITE_ROW ){
        rid = db_column_int(&q, 0);
        zCIUuid = zCI = fossil_strdup(db_column_text(&q, 1));
        url_add_parameter(&url, "ci", zCI);
      }
      db_finalize(&q);
      if( rid==0 ){     
        style_header("No such file");
        @ File '%h(zName)' does not exist in this repository.
      }
    }else{
      style_header("No such artifact");
      @ Artifact '%h(zName)' does not exist in this repository.
    }
    if( rid==0 ){
      style_footer();
      return;
    }
  }

  if( descOnly || P("verbose")!=0 ){
    url_add_parameter(&url, "verbose", "1");
    objdescFlags |= OBJDESC_DETAIL;
  }
  zUuid = db_text("?", "SELECT uuid FROM blob WHERE rid=%d", rid);