Fossil SCM
Fix the unversioned_content_hash() function so that it returns the SHA1 of a zero-length buffer if the "unversioned" table does not exist.
Commit
ccce70fb59a636ab7576863032bf45ef69a1842529de55386af1fdffbfeb91e0
Parent
a965221ab24876b…
1 file changed
+4
-1
+4
-1
| --- src/unversioned.c | ||
| +++ src/unversioned.c | ||
| @@ -62,11 +62,14 @@ | ||
| 62 | 62 | ** If debugFlag is set, force the value to be recomputed and write |
| 63 | 63 | ** the text of the hashed string to stdout. |
| 64 | 64 | */ |
| 65 | 65 | const char *unversioned_content_hash(int debugFlag){ |
| 66 | 66 | const char *zHash = debugFlag ? 0 : db_get("uv-hash", 0); |
| 67 | - if( zHash==0 ){ | |
| 67 | + if( zHash ) return zHash; | |
| 68 | + if( !db_table_exists("repository","unversioned") ){ | |
| 69 | + return "da39a3ee5e6b4b0d3255bfef95601890afd80709"; | |
| 70 | + }else{ | |
| 68 | 71 | Stmt q; |
| 69 | 72 | db_prepare(&q, |
| 70 | 73 | "SELECT printf('%%s %%s %%s\n',name,datetime(mtime,'unixepoch'),hash)" |
| 71 | 74 | " FROM unversioned" |
| 72 | 75 | " WHERE hash IS NOT NULL" |
| 73 | 76 |
| --- src/unversioned.c | |
| +++ src/unversioned.c | |
| @@ -62,11 +62,14 @@ | |
| 62 | ** If debugFlag is set, force the value to be recomputed and write |
| 63 | ** the text of the hashed string to stdout. |
| 64 | */ |
| 65 | const char *unversioned_content_hash(int debugFlag){ |
| 66 | const char *zHash = debugFlag ? 0 : db_get("uv-hash", 0); |
| 67 | if( zHash==0 ){ |
| 68 | Stmt q; |
| 69 | db_prepare(&q, |
| 70 | "SELECT printf('%%s %%s %%s\n',name,datetime(mtime,'unixepoch'),hash)" |
| 71 | " FROM unversioned" |
| 72 | " WHERE hash IS NOT NULL" |
| 73 |
| --- src/unversioned.c | |
| +++ src/unversioned.c | |
| @@ -62,11 +62,14 @@ | |
| 62 | ** If debugFlag is set, force the value to be recomputed and write |
| 63 | ** the text of the hashed string to stdout. |
| 64 | */ |
| 65 | const char *unversioned_content_hash(int debugFlag){ |
| 66 | const char *zHash = debugFlag ? 0 : db_get("uv-hash", 0); |
| 67 | if( zHash ) return zHash; |
| 68 | if( !db_table_exists("repository","unversioned") ){ |
| 69 | return "da39a3ee5e6b4b0d3255bfef95601890afd80709"; |
| 70 | }else{ |
| 71 | Stmt q; |
| 72 | db_prepare(&q, |
| 73 | "SELECT printf('%%s %%s %%s\n',name,datetime(mtime,'unixepoch'),hash)" |
| 74 | " FROM unversioned" |
| 75 | " WHERE hash IS NOT NULL" |
| 76 |