Fossil SCM
Fill islink field in vfile table when adding files. Support symlinks in export. Make manifest_file_perm() return 2 for symlinks. Add file_perm() function, and use it instead of file_isexe() when we need both isexe and islink properties.
Commit
4619361d585c8c52a827eb8a470c8e0cbe28f3e2
Parent
2de9e87600d6a44…
8 files changed
+3
-3
+10
-2
+15
+3
-3
+6
-3
+2
-5
+2
-3
+3
-3
+3
-3
| --- src/add.c | ||
| +++ src/add.c | ||
| @@ -106,13 +106,13 @@ | ||
| 106 | 106 | db_multi_exec("UPDATE vfile SET deleted=0" |
| 107 | 107 | " WHERE pathname=%Q COLLATE %s", zPath, zCollate); |
| 108 | 108 | }else{ |
| 109 | 109 | char *zFullname = mprintf("%s%s", g.zLocalRoot, zPath); |
| 110 | 110 | db_multi_exec( |
| 111 | - "INSERT INTO vfile(vid,deleted,rid,mrid,pathname,isexe)" | |
| 112 | - "VALUES(%d,0,0,0,%Q,%d)", | |
| 113 | - vid, zPath, file_isexe(zFullname)); | |
| 111 | + "INSERT INTO vfile(vid,deleted,rid,mrid,pathname,isexe,islink)" | |
| 112 | + "VALUES(%d,0,0,0,%Q,%d,%d)", | |
| 113 | + vid, zPath, file_isexe(zFullname), file_islink(zFullname)); | |
| 114 | 114 | fossil_free(zFullname); |
| 115 | 115 | } |
| 116 | 116 | if( db_changes() ){ |
| 117 | 117 | fossil_print("ADDED %s\n", zPath); |
| 118 | 118 | return 1; |
| 119 | 119 |
| --- src/add.c | |
| +++ src/add.c | |
| @@ -106,13 +106,13 @@ | |
| 106 | db_multi_exec("UPDATE vfile SET deleted=0" |
| 107 | " WHERE pathname=%Q COLLATE %s", zPath, zCollate); |
| 108 | }else{ |
| 109 | char *zFullname = mprintf("%s%s", g.zLocalRoot, zPath); |
| 110 | db_multi_exec( |
| 111 | "INSERT INTO vfile(vid,deleted,rid,mrid,pathname,isexe)" |
| 112 | "VALUES(%d,0,0,0,%Q,%d)", |
| 113 | vid, zPath, file_isexe(zFullname)); |
| 114 | fossil_free(zFullname); |
| 115 | } |
| 116 | if( db_changes() ){ |
| 117 | fossil_print("ADDED %s\n", zPath); |
| 118 | return 1; |
| 119 |
| --- src/add.c | |
| +++ src/add.c | |
| @@ -106,13 +106,13 @@ | |
| 106 | db_multi_exec("UPDATE vfile SET deleted=0" |
| 107 | " WHERE pathname=%Q COLLATE %s", zPath, zCollate); |
| 108 | }else{ |
| 109 | char *zFullname = mprintf("%s%s", g.zLocalRoot, zPath); |
| 110 | db_multi_exec( |
| 111 | "INSERT INTO vfile(vid,deleted,rid,mrid,pathname,isexe,islink)" |
| 112 | "VALUES(%d,0,0,0,%Q,%d,%d)", |
| 113 | vid, zPath, file_isexe(zFullname), file_islink(zFullname)); |
| 114 | fossil_free(zFullname); |
| 115 | } |
| 116 | if( db_changes() ){ |
| 117 | fossil_print("ADDED %s\n", zPath); |
| 118 | return 1; |
| 119 |
+10
-2
| --- src/export.c | ||
| +++ src/export.c | ||
| @@ -269,12 +269,20 @@ | ||
| 269 | 269 | const char *zName = db_column_text(&q4,0); |
| 270 | 270 | int zNew = db_column_int(&q4,1); |
| 271 | 271 | int mPerm = db_column_int(&q4,2); |
| 272 | 272 | if( zNew==0) |
| 273 | 273 | printf("D %s\n", zName); |
| 274 | - else if( bag_find(&blobs, zNew) ) | |
| 275 | - printf("M %s :%d %s\n", mPerm ? "100755" : "100644", BLOBMARK(zNew), zName); | |
| 274 | + else if( bag_find(&blobs, zNew) ) { | |
| 275 | + const char *zPerm; | |
| 276 | + if( mPerm==1 ) | |
| 277 | + zPerm = "100755"; | |
| 278 | + else if( mPerm==2 ) | |
| 279 | + zPerm = "120000"; | |
| 280 | + else | |
| 281 | + zPerm = "100644"; | |
| 282 | + printf("M %s :%d %s\n", zPerm, BLOBMARK(zNew), zName); | |
| 283 | + } | |
| 276 | 284 | } |
| 277 | 285 | db_finalize(&q4); |
| 278 | 286 | db_finalize(&q3); |
| 279 | 287 | printf("\n"); |
| 280 | 288 | } |
| 281 | 289 |
| --- src/export.c | |
| +++ src/export.c | |
| @@ -269,12 +269,20 @@ | |
| 269 | const char *zName = db_column_text(&q4,0); |
| 270 | int zNew = db_column_int(&q4,1); |
| 271 | int mPerm = db_column_int(&q4,2); |
| 272 | if( zNew==0) |
| 273 | printf("D %s\n", zName); |
| 274 | else if( bag_find(&blobs, zNew) ) |
| 275 | printf("M %s :%d %s\n", mPerm ? "100755" : "100644", BLOBMARK(zNew), zName); |
| 276 | } |
| 277 | db_finalize(&q4); |
| 278 | db_finalize(&q3); |
| 279 | printf("\n"); |
| 280 | } |
| 281 |
| --- src/export.c | |
| +++ src/export.c | |
| @@ -269,12 +269,20 @@ | |
| 269 | const char *zName = db_column_text(&q4,0); |
| 270 | int zNew = db_column_int(&q4,1); |
| 271 | int mPerm = db_column_int(&q4,2); |
| 272 | if( zNew==0) |
| 273 | printf("D %s\n", zName); |
| 274 | else if( bag_find(&blobs, zNew) ) { |
| 275 | const char *zPerm; |
| 276 | if( mPerm==1 ) |
| 277 | zPerm = "100755"; |
| 278 | else if( mPerm==2 ) |
| 279 | zPerm = "120000"; |
| 280 | else |
| 281 | zPerm = "100644"; |
| 282 | printf("M %s :%d %s\n", zPerm, BLOBMARK(zNew), zName); |
| 283 | } |
| 284 | } |
| 285 | db_finalize(&q4); |
| 286 | db_finalize(&q3); |
| 287 | printf("\n"); |
| 288 | } |
| 289 |
+15
| --- src/file.c | ||
| +++ src/file.c | ||
| @@ -197,10 +197,25 @@ | ||
| 197 | 197 | #else |
| 198 | 198 | return ((S_IXUSR|S_IXGRP|S_IXOTH)&fileStat.st_mode)!=0; |
| 199 | 199 | #endif |
| 200 | 200 | } |
| 201 | 201 | |
| 202 | + | |
| 203 | +/* | |
| 204 | +** Return file "permissions": | |
| 205 | +** 0: normal | |
| 206 | +** 1: exec | |
| 207 | +** 2: symlink | |
| 208 | +*/ | |
| 209 | +int file_perm(const char *zFilename){ | |
| 210 | + //TODO(dchest): optimize by calling stat once. | |
| 211 | + if( file_isexe(zFilename) ) | |
| 212 | + return 1; | |
| 213 | + if( file_islink(zFilename) ) | |
| 214 | + return 2; | |
| 215 | + return 0; | |
| 216 | +} | |
| 202 | 217 | |
| 203 | 218 | /* |
| 204 | 219 | ** Return 1 if zFilename is a directory. Return 0 if zFilename |
| 205 | 220 | ** does not exist. Return 2 if zFilename exists but is something |
| 206 | 221 | ** other than a directory. |
| 207 | 222 |
| --- src/file.c | |
| +++ src/file.c | |
| @@ -197,10 +197,25 @@ | |
| 197 | #else |
| 198 | return ((S_IXUSR|S_IXGRP|S_IXOTH)&fileStat.st_mode)!=0; |
| 199 | #endif |
| 200 | } |
| 201 | |
| 202 | |
| 203 | /* |
| 204 | ** Return 1 if zFilename is a directory. Return 0 if zFilename |
| 205 | ** does not exist. Return 2 if zFilename exists but is something |
| 206 | ** other than a directory. |
| 207 |
| --- src/file.c | |
| +++ src/file.c | |
| @@ -197,10 +197,25 @@ | |
| 197 | #else |
| 198 | return ((S_IXUSR|S_IXGRP|S_IXOTH)&fileStat.st_mode)!=0; |
| 199 | #endif |
| 200 | } |
| 201 | |
| 202 | |
| 203 | /* |
| 204 | ** Return file "permissions": |
| 205 | ** 0: normal |
| 206 | ** 1: exec |
| 207 | ** 2: symlink |
| 208 | */ |
| 209 | int file_perm(const char *zFilename){ |
| 210 | //TODO(dchest): optimize by calling stat once. |
| 211 | if( file_isexe(zFilename) ) |
| 212 | return 1; |
| 213 | if( file_islink(zFilename) ) |
| 214 | return 2; |
| 215 | return 0; |
| 216 | } |
| 217 | |
| 218 | /* |
| 219 | ** Return 1 if zFilename is a directory. Return 0 if zFilename |
| 220 | ** does not exist. Return 2 if zFilename exists but is something |
| 221 | ** other than a directory. |
| 222 |
+3
-3
| --- src/info.c | ||
| +++ src/info.c | ||
| @@ -282,21 +282,21 @@ | ||
| 282 | 282 | const char *zName, /* Name of the file that has changed */ |
| 283 | 283 | const char *zOld, /* blob.uuid before change. NULL for added files */ |
| 284 | 284 | const char *zNew, /* blob.uuid after change. NULL for deletes */ |
| 285 | 285 | const char *zOldName, /* Prior name. NULL if no name change. */ |
| 286 | 286 | int showDiff, /* Show edit diffs if true */ |
| 287 | - int mperm /* EXE permission for zNew */ | |
| 287 | + int mperm /* executable or symlink permission for zNew */ | |
| 288 | 288 | ){ |
| 289 | 289 | if( !g.okHistory ){ |
| 290 | 290 | if( zNew==0 ){ |
| 291 | 291 | @ <p>Deleted %h(zName)</p> |
| 292 | 292 | }else if( zOld==0 ){ |
| 293 | 293 | @ <p>Added %h(zName)</p> |
| 294 | 294 | }else if( zOldName!=0 && fossil_strcmp(zName,zOldName)!=0 ){ |
| 295 | 295 | @ <p>Name change from %h(zOldName) to %h(zName) |
| 296 | 296 | }else if( fossil_strcmp(zNew, zOld)==0 ){ |
| 297 | - @ <p>Execute permission %s(mperm?"set":"cleared") for %h(zName)</p> | |
| 297 | + @ <p>Execute permission %s(( mperm==1 )?"set":"cleared") for %h(zName)</p> | |
| 298 | 298 | }else{ |
| 299 | 299 | @ <p>Changes to %h(zName)</p> |
| 300 | 300 | } |
| 301 | 301 | if( showDiff ){ |
| 302 | 302 | @ <blockquote><pre> |
| @@ -312,11 +312,11 @@ | ||
| 312 | 312 | }else if( zOldName!=0 && fossil_strcmp(zName,zOldName)!=0 ){ |
| 313 | 313 | @ <p>Name change from |
| 314 | 314 | @ from <a href="%s(g.zTop)/finfo?name=%T(zOldName)">%h(zOldName)</a> |
| 315 | 315 | @ to <a href="%s(g.zTop)/finfo?name=%T(zName)">%h(zName)</a>. |
| 316 | 316 | }else{ |
| 317 | - @ <p>Execute permission %s(mperm?"set":"cleared") for | |
| 317 | + @ <p>Execute permission %s(( mperm==1 )?"set":"cleared") for | |
| 318 | 318 | @ <a href="%s(g.zTop)/finfo?name=%T(zName)">%h(zName)</a> |
| 319 | 319 | } |
| 320 | 320 | }else if( zOld ){ |
| 321 | 321 | @ <p>Deleted <a href="%s(g.zTop)/finfo?name=%T(zName)">%h(zName)</a> |
| 322 | 322 | @ version <a href="%s(g.zTop)/artifact/%s(zOld)">[%S(zOld)]</a> |
| 323 | 323 |
| --- src/info.c | |
| +++ src/info.c | |
| @@ -282,21 +282,21 @@ | |
| 282 | const char *zName, /* Name of the file that has changed */ |
| 283 | const char *zOld, /* blob.uuid before change. NULL for added files */ |
| 284 | const char *zNew, /* blob.uuid after change. NULL for deletes */ |
| 285 | const char *zOldName, /* Prior name. NULL if no name change. */ |
| 286 | int showDiff, /* Show edit diffs if true */ |
| 287 | int mperm /* EXE permission for zNew */ |
| 288 | ){ |
| 289 | if( !g.okHistory ){ |
| 290 | if( zNew==0 ){ |
| 291 | @ <p>Deleted %h(zName)</p> |
| 292 | }else if( zOld==0 ){ |
| 293 | @ <p>Added %h(zName)</p> |
| 294 | }else if( zOldName!=0 && fossil_strcmp(zName,zOldName)!=0 ){ |
| 295 | @ <p>Name change from %h(zOldName) to %h(zName) |
| 296 | }else if( fossil_strcmp(zNew, zOld)==0 ){ |
| 297 | @ <p>Execute permission %s(mperm?"set":"cleared") for %h(zName)</p> |
| 298 | }else{ |
| 299 | @ <p>Changes to %h(zName)</p> |
| 300 | } |
| 301 | if( showDiff ){ |
| 302 | @ <blockquote><pre> |
| @@ -312,11 +312,11 @@ | |
| 312 | }else if( zOldName!=0 && fossil_strcmp(zName,zOldName)!=0 ){ |
| 313 | @ <p>Name change from |
| 314 | @ from <a href="%s(g.zTop)/finfo?name=%T(zOldName)">%h(zOldName)</a> |
| 315 | @ to <a href="%s(g.zTop)/finfo?name=%T(zName)">%h(zName)</a>. |
| 316 | }else{ |
| 317 | @ <p>Execute permission %s(mperm?"set":"cleared") for |
| 318 | @ <a href="%s(g.zTop)/finfo?name=%T(zName)">%h(zName)</a> |
| 319 | } |
| 320 | }else if( zOld ){ |
| 321 | @ <p>Deleted <a href="%s(g.zTop)/finfo?name=%T(zName)">%h(zName)</a> |
| 322 | @ version <a href="%s(g.zTop)/artifact/%s(zOld)">[%S(zOld)]</a> |
| 323 |
| --- src/info.c | |
| +++ src/info.c | |
| @@ -282,21 +282,21 @@ | |
| 282 | const char *zName, /* Name of the file that has changed */ |
| 283 | const char *zOld, /* blob.uuid before change. NULL for added files */ |
| 284 | const char *zNew, /* blob.uuid after change. NULL for deletes */ |
| 285 | const char *zOldName, /* Prior name. NULL if no name change. */ |
| 286 | int showDiff, /* Show edit diffs if true */ |
| 287 | int mperm /* executable or symlink permission for zNew */ |
| 288 | ){ |
| 289 | if( !g.okHistory ){ |
| 290 | if( zNew==0 ){ |
| 291 | @ <p>Deleted %h(zName)</p> |
| 292 | }else if( zOld==0 ){ |
| 293 | @ <p>Added %h(zName)</p> |
| 294 | }else if( zOldName!=0 && fossil_strcmp(zName,zOldName)!=0 ){ |
| 295 | @ <p>Name change from %h(zOldName) to %h(zName) |
| 296 | }else if( fossil_strcmp(zNew, zOld)==0 ){ |
| 297 | @ <p>Execute permission %s(( mperm==1 )?"set":"cleared") for %h(zName)</p> |
| 298 | }else{ |
| 299 | @ <p>Changes to %h(zName)</p> |
| 300 | } |
| 301 | if( showDiff ){ |
| 302 | @ <blockquote><pre> |
| @@ -312,11 +312,11 @@ | |
| 312 | }else if( zOldName!=0 && fossil_strcmp(zName,zOldName)!=0 ){ |
| 313 | @ <p>Name change from |
| 314 | @ from <a href="%s(g.zTop)/finfo?name=%T(zOldName)">%h(zOldName)</a> |
| 315 | @ to <a href="%s(g.zTop)/finfo?name=%T(zName)">%h(zName)</a>. |
| 316 | }else{ |
| 317 | @ <p>Execute permission %s(( mperm==1 )?"set":"cleared") for |
| 318 | @ <a href="%s(g.zTop)/finfo?name=%T(zName)">%h(zName)</a> |
| 319 | } |
| 320 | }else if( zOld ){ |
| 321 | @ <p>Deleted <a href="%s(g.zTop)/finfo?name=%T(zName)">%h(zName)</a> |
| 322 | @ version <a href="%s(g.zTop)/artifact/%s(zOld)">[%S(zOld)]</a> |
| 323 |
+6
-3
| --- src/manifest.c | ||
| +++ src/manifest.c | ||
| @@ -1086,12 +1086,15 @@ | ||
| 1086 | 1086 | ** Compute an appropriate mlink.mperm integer for the permission string |
| 1087 | 1087 | ** of a file. |
| 1088 | 1088 | */ |
| 1089 | 1089 | int manifest_file_mperm(ManifestFile *pFile){ |
| 1090 | 1090 | int mperm = 0; |
| 1091 | - if( pFile && pFile->zPerm && strstr(pFile->zPerm,"x")!=0 ){ | |
| 1092 | - mperm = 1; | |
| 1091 | + if( pFile && pFile->zPerm){ | |
| 1092 | + if( strstr(pFile->zPerm,"x")!=0 ) | |
| 1093 | + mperm = 1; | |
| 1094 | + else if( strstr(pFile->zPerm,"l")!=0 ) | |
| 1095 | + mperm = 2; | |
| 1093 | 1096 | } |
| 1094 | 1097 | return mperm; |
| 1095 | 1098 | } |
| 1096 | 1099 | |
| 1097 | 1100 | /* |
| @@ -1103,11 +1106,11 @@ | ||
| 1103 | 1106 | const char *zFromUuid, /* UUID for the mlink.pid. "" to add file */ |
| 1104 | 1107 | const char *zToUuid, /* UUID for the mlink.fid. "" to delele */ |
| 1105 | 1108 | const char *zFilename, /* Filename */ |
| 1106 | 1109 | const char *zPrior, /* Previous filename. NULL if unchanged */ |
| 1107 | 1110 | int isPublic, /* True if mid is not a private manifest */ |
| 1108 | - int mperm /* 1: exec */ | |
| 1111 | + int mperm /* 1: exec, 2: symlink */ | |
| 1109 | 1112 | ){ |
| 1110 | 1113 | int fnid, pfnid, pid, fid; |
| 1111 | 1114 | static Stmt s1; |
| 1112 | 1115 | |
| 1113 | 1116 | fnid = filename_to_fnid(zFilename); |
| 1114 | 1117 |
| --- src/manifest.c | |
| +++ src/manifest.c | |
| @@ -1086,12 +1086,15 @@ | |
| 1086 | ** Compute an appropriate mlink.mperm integer for the permission string |
| 1087 | ** of a file. |
| 1088 | */ |
| 1089 | int manifest_file_mperm(ManifestFile *pFile){ |
| 1090 | int mperm = 0; |
| 1091 | if( pFile && pFile->zPerm && strstr(pFile->zPerm,"x")!=0 ){ |
| 1092 | mperm = 1; |
| 1093 | } |
| 1094 | return mperm; |
| 1095 | } |
| 1096 | |
| 1097 | /* |
| @@ -1103,11 +1106,11 @@ | |
| 1103 | const char *zFromUuid, /* UUID for the mlink.pid. "" to add file */ |
| 1104 | const char *zToUuid, /* UUID for the mlink.fid. "" to delele */ |
| 1105 | const char *zFilename, /* Filename */ |
| 1106 | const char *zPrior, /* Previous filename. NULL if unchanged */ |
| 1107 | int isPublic, /* True if mid is not a private manifest */ |
| 1108 | int mperm /* 1: exec */ |
| 1109 | ){ |
| 1110 | int fnid, pfnid, pid, fid; |
| 1111 | static Stmt s1; |
| 1112 | |
| 1113 | fnid = filename_to_fnid(zFilename); |
| 1114 |
| --- src/manifest.c | |
| +++ src/manifest.c | |
| @@ -1086,12 +1086,15 @@ | |
| 1086 | ** Compute an appropriate mlink.mperm integer for the permission string |
| 1087 | ** of a file. |
| 1088 | */ |
| 1089 | int manifest_file_mperm(ManifestFile *pFile){ |
| 1090 | int mperm = 0; |
| 1091 | if( pFile && pFile->zPerm){ |
| 1092 | if( strstr(pFile->zPerm,"x")!=0 ) |
| 1093 | mperm = 1; |
| 1094 | else if( strstr(pFile->zPerm,"l")!=0 ) |
| 1095 | mperm = 2; |
| 1096 | } |
| 1097 | return mperm; |
| 1098 | } |
| 1099 | |
| 1100 | /* |
| @@ -1103,11 +1106,11 @@ | |
| 1106 | const char *zFromUuid, /* UUID for the mlink.pid. "" to add file */ |
| 1107 | const char *zToUuid, /* UUID for the mlink.fid. "" to delele */ |
| 1108 | const char *zFilename, /* Filename */ |
| 1109 | const char *zPrior, /* Previous filename. NULL if unchanged */ |
| 1110 | int isPublic, /* True if mid is not a private manifest */ |
| 1111 | int mperm /* 1: exec, 2: symlink */ |
| 1112 | ){ |
| 1113 | int fnid, pfnid, pid, fid; |
| 1114 | static Stmt s1; |
| 1115 | |
| 1116 | fnid = filename_to_fnid(zFilename); |
| 1117 |
+2
-5
| --- src/update.c | ||
| +++ src/update.c | ||
| @@ -568,15 +568,12 @@ | ||
| 568 | 568 | |
| 569 | 569 | if( pManifest ){ |
| 570 | 570 | pFile = manifest_file_seek(pManifest, file); |
| 571 | 571 | if( pFile ){ |
| 572 | 572 | rid = uuid_to_rid(pFile->zUuid, 0); |
| 573 | - if( pIsExe ) *pIsExe = manifest_file_mperm(pFile); | |
| 574 | - if( pIsLink ){ | |
| 575 | - //TODO(dchest): figure out how to fit manifest_file_mperm. | |
| 576 | - *pIsLink = pFile->zPerm && strstr(pFile->zPerm, "l") ? 1 : 0; | |
| 577 | - } | |
| 573 | + if( pIsExe ) *pIsExe = ( manifest_file_mperm(pFile)==1 ); | |
| 574 | + if( pIsLink ) *pIsLink = ( manifest_file_mperm(pFile)==2 ); | |
| 578 | 575 | manifest_destroy(pManifest); |
| 579 | 576 | return content_get(rid, content); |
| 580 | 577 | } |
| 581 | 578 | manifest_destroy(pManifest); |
| 582 | 579 | if( errCode<=0 ){ |
| 583 | 580 |
| --- src/update.c | |
| +++ src/update.c | |
| @@ -568,15 +568,12 @@ | |
| 568 | |
| 569 | if( pManifest ){ |
| 570 | pFile = manifest_file_seek(pManifest, file); |
| 571 | if( pFile ){ |
| 572 | rid = uuid_to_rid(pFile->zUuid, 0); |
| 573 | if( pIsExe ) *pIsExe = manifest_file_mperm(pFile); |
| 574 | if( pIsLink ){ |
| 575 | //TODO(dchest): figure out how to fit manifest_file_mperm. |
| 576 | *pIsLink = pFile->zPerm && strstr(pFile->zPerm, "l") ? 1 : 0; |
| 577 | } |
| 578 | manifest_destroy(pManifest); |
| 579 | return content_get(rid, content); |
| 580 | } |
| 581 | manifest_destroy(pManifest); |
| 582 | if( errCode<=0 ){ |
| 583 |
| --- src/update.c | |
| +++ src/update.c | |
| @@ -568,15 +568,12 @@ | |
| 568 | |
| 569 | if( pManifest ){ |
| 570 | pFile = manifest_file_seek(pManifest, file); |
| 571 | if( pFile ){ |
| 572 | rid = uuid_to_rid(pFile->zUuid, 0); |
| 573 | if( pIsExe ) *pIsExe = ( manifest_file_mperm(pFile)==1 ); |
| 574 | if( pIsLink ) *pIsLink = ( manifest_file_mperm(pFile)==2 ); |
| 575 | manifest_destroy(pManifest); |
| 576 | return content_get(rid, content); |
| 577 | } |
| 578 | manifest_destroy(pManifest); |
| 579 | if( errCode<=0 ){ |
| 580 |
+2
-3
| --- src/vfile.c | ||
| +++ src/vfile.c | ||
| @@ -110,15 +110,14 @@ | ||
| 110 | 110 | db_reset(&ridq); |
| 111 | 111 | if( rid==0 || size<0 ){ |
| 112 | 112 | fossil_warning("content missing for %s", pFile->zName); |
| 113 | 113 | continue; |
| 114 | 114 | } |
| 115 | - db_bind_int(&ins, ":isexe", manifest_file_mperm(pFile)); | |
| 115 | + db_bind_int(&ins, ":isexe", ( manifest_file_mperm(pFile)==1 )); | |
| 116 | 116 | db_bind_int(&ins, ":id", rid); |
| 117 | 117 | db_bind_text(&ins, ":name", pFile->zName); |
| 118 | - //TODO(dchest) figure out how to fit manifest_file_mperm here: | |
| 119 | - db_bind_int(&ins, ":islink", pFile->zPerm && strstr(pFile->zPerm, "l")); | |
| 118 | + db_bind_int(&ins, ":islink", ( manifest_file_mperm(pFile)==2 )); | |
| 120 | 119 | db_step(&ins); |
| 121 | 120 | db_reset(&ins); |
| 122 | 121 | } |
| 123 | 122 | db_finalize(&ridq); |
| 124 | 123 | db_finalize(&ins); |
| 125 | 124 |
| --- src/vfile.c | |
| +++ src/vfile.c | |
| @@ -110,15 +110,14 @@ | |
| 110 | db_reset(&ridq); |
| 111 | if( rid==0 || size<0 ){ |
| 112 | fossil_warning("content missing for %s", pFile->zName); |
| 113 | continue; |
| 114 | } |
| 115 | db_bind_int(&ins, ":isexe", manifest_file_mperm(pFile)); |
| 116 | db_bind_int(&ins, ":id", rid); |
| 117 | db_bind_text(&ins, ":name", pFile->zName); |
| 118 | //TODO(dchest) figure out how to fit manifest_file_mperm here: |
| 119 | db_bind_int(&ins, ":islink", pFile->zPerm && strstr(pFile->zPerm, "l")); |
| 120 | db_step(&ins); |
| 121 | db_reset(&ins); |
| 122 | } |
| 123 | db_finalize(&ridq); |
| 124 | db_finalize(&ins); |
| 125 |
| --- src/vfile.c | |
| +++ src/vfile.c | |
| @@ -110,15 +110,14 @@ | |
| 110 | db_reset(&ridq); |
| 111 | if( rid==0 || size<0 ){ |
| 112 | fossil_warning("content missing for %s", pFile->zName); |
| 113 | continue; |
| 114 | } |
| 115 | db_bind_int(&ins, ":isexe", ( manifest_file_mperm(pFile)==1 )); |
| 116 | db_bind_int(&ins, ":id", rid); |
| 117 | db_bind_text(&ins, ":name", pFile->zName); |
| 118 | db_bind_int(&ins, ":islink", ( manifest_file_mperm(pFile)==2 )); |
| 119 | db_step(&ins); |
| 120 | db_reset(&ins); |
| 121 | } |
| 122 | db_finalize(&ridq); |
| 123 | db_finalize(&ins); |
| 124 |
+3
-3
| --- src/zip.c | ||
| +++ src/zip.c | ||
| @@ -117,11 +117,11 @@ | ||
| 117 | 117 | ** Append a single file to a growing ZIP archive. |
| 118 | 118 | ** |
| 119 | 119 | ** pFile is the file to be appended. zName is the name |
| 120 | 120 | ** that the file should be saved as. |
| 121 | 121 | */ |
| 122 | -void zip_add_file(const char *zName, const Blob *pFile, int isExe){ | |
| 122 | +void zip_add_file(const char *zName, const Blob *pFile, int mPerm){ | |
| 123 | 123 | z_stream stream; |
| 124 | 124 | int nameLen; |
| 125 | 125 | int toOut = 0; |
| 126 | 126 | int iStart; |
| 127 | 127 | int iCRC = 0; |
| @@ -139,11 +139,11 @@ | ||
| 139 | 139 | /* Fill in as much of the header as we know. |
| 140 | 140 | */ |
| 141 | 141 | nBlob = pFile ? blob_size(pFile) : 0; |
| 142 | 142 | if( nBlob>0 ){ |
| 143 | 143 | iMethod = 8; |
| 144 | - iMode = isExe ? 0100755 : 0100644; | |
| 144 | + iMode = ( mPerm == 1 ) ? 0100755 : 0100644; //TODO(dchest): handle links | |
| 145 | 145 | }else{ |
| 146 | 146 | iMethod = 0; |
| 147 | 147 | iMode = 040755; |
| 148 | 148 | } |
| 149 | 149 | nameLen = strlen(zName); |
| @@ -287,11 +287,11 @@ | ||
| 287 | 287 | } |
| 288 | 288 | zip_open(); |
| 289 | 289 | for(i=3; i<g.argc; i++){ |
| 290 | 290 | blob_zero(&file); |
| 291 | 291 | blob_read_from_file(&file, g.argv[i]); |
| 292 | - zip_add_file(g.argv[i], &file, file_isexe(g.argv[i])); | |
| 292 | + zip_add_file(g.argv[i], &file, file_perm(g.argv[i])); | |
| 293 | 293 | blob_reset(&file); |
| 294 | 294 | } |
| 295 | 295 | zip_close(&zip); |
| 296 | 296 | blob_write_to_file(&zip, g.argv[2]); |
| 297 | 297 | } |
| 298 | 298 |
| --- src/zip.c | |
| +++ src/zip.c | |
| @@ -117,11 +117,11 @@ | |
| 117 | ** Append a single file to a growing ZIP archive. |
| 118 | ** |
| 119 | ** pFile is the file to be appended. zName is the name |
| 120 | ** that the file should be saved as. |
| 121 | */ |
| 122 | void zip_add_file(const char *zName, const Blob *pFile, int isExe){ |
| 123 | z_stream stream; |
| 124 | int nameLen; |
| 125 | int toOut = 0; |
| 126 | int iStart; |
| 127 | int iCRC = 0; |
| @@ -139,11 +139,11 @@ | |
| 139 | /* Fill in as much of the header as we know. |
| 140 | */ |
| 141 | nBlob = pFile ? blob_size(pFile) : 0; |
| 142 | if( nBlob>0 ){ |
| 143 | iMethod = 8; |
| 144 | iMode = isExe ? 0100755 : 0100644; |
| 145 | }else{ |
| 146 | iMethod = 0; |
| 147 | iMode = 040755; |
| 148 | } |
| 149 | nameLen = strlen(zName); |
| @@ -287,11 +287,11 @@ | |
| 287 | } |
| 288 | zip_open(); |
| 289 | for(i=3; i<g.argc; i++){ |
| 290 | blob_zero(&file); |
| 291 | blob_read_from_file(&file, g.argv[i]); |
| 292 | zip_add_file(g.argv[i], &file, file_isexe(g.argv[i])); |
| 293 | blob_reset(&file); |
| 294 | } |
| 295 | zip_close(&zip); |
| 296 | blob_write_to_file(&zip, g.argv[2]); |
| 297 | } |
| 298 |
| --- src/zip.c | |
| +++ src/zip.c | |
| @@ -117,11 +117,11 @@ | |
| 117 | ** Append a single file to a growing ZIP archive. |
| 118 | ** |
| 119 | ** pFile is the file to be appended. zName is the name |
| 120 | ** that the file should be saved as. |
| 121 | */ |
| 122 | void zip_add_file(const char *zName, const Blob *pFile, int mPerm){ |
| 123 | z_stream stream; |
| 124 | int nameLen; |
| 125 | int toOut = 0; |
| 126 | int iStart; |
| 127 | int iCRC = 0; |
| @@ -139,11 +139,11 @@ | |
| 139 | /* Fill in as much of the header as we know. |
| 140 | */ |
| 141 | nBlob = pFile ? blob_size(pFile) : 0; |
| 142 | if( nBlob>0 ){ |
| 143 | iMethod = 8; |
| 144 | iMode = ( mPerm == 1 ) ? 0100755 : 0100644; //TODO(dchest): handle links |
| 145 | }else{ |
| 146 | iMethod = 0; |
| 147 | iMode = 040755; |
| 148 | } |
| 149 | nameLen = strlen(zName); |
| @@ -287,11 +287,11 @@ | |
| 287 | } |
| 288 | zip_open(); |
| 289 | for(i=3; i<g.argc; i++){ |
| 290 | blob_zero(&file); |
| 291 | blob_read_from_file(&file, g.argv[i]); |
| 292 | zip_add_file(g.argv[i], &file, file_perm(g.argv[i])); |
| 293 | blob_reset(&file); |
| 294 | } |
| 295 | zip_close(&zip); |
| 296 | blob_write_to_file(&zip, g.argv[2]); |
| 297 | } |
| 298 |