Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Refactored symlink_create repeated block of code into a checked_symlink_create function. |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | bad-winsymlink |
Files: | files | file ages | folders |
SHA1: |
2d3ff7bd23b170343e613564f59f7201 |
User & Date: | sdr 2014-09-20 18:32:44 |
Context
2014-09-20
| ||
18:41 | Changed name of checked_symlink_create to create_symlink_or_file as it is more accurate / descriptive. Also changed some parameter names, and fixed a couple spelling errors (accidentally typed blog instead of blob and never compiled; oops). check-in: 31b0a9d737 user: sdr tags: bad-winsymlink | |
18:32 | Refactored symlink_create repeated block of code into a checked_symlink_create function. check-in: 2d3ff7bd23 user: sdr tags: bad-winsymlink | |
18:11 | Modified revert to always process symbolic links. Also added link_delete to complement file_delete, as windows needs special delete handling for symbolic links as they might be directory symlinks. check-in: 9e0ba1215d user: sdr tags: bad-winsymlink | |
Changes
Changes to src/file.c.
︙ | ︙ | |||
239 240 241 242 243 244 245 246 247 248 249 250 251 252 | }else{ Blob content; blob_set(&content, zTargetFile); blob_write_to_file(&content, zLinkFile); blob_reset(&content); } } /* ** Copy symbolic link from zFrom to zTo. */ void symlink_copy(const char *zFrom, const char *zTo){ Blob content; blob_read_link(&content, zFrom); | > > > > > > > > > | 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 | }else{ Blob content; blob_set(&content, zTargetFile); blob_write_to_file(&content, zLinkFile); blob_reset(&content); } } void checked_symlink_create(int needDelete, int needLink, int maybeLink, Blob* blob, const char* zName){ if (needDelete && (needLink || maybeLink)) link_delete(zName); if (needLink) symlink_create(blog_str(blob), zName); else blog_write_to_file(blob, zName); } /* ** Copy symbolic link from zFrom to zTo. */ void symlink_copy(const char *zFrom, const char *zTo){ Blob content; blob_read_link(&content, zFrom); |
︙ | ︙ |
Changes to src/stash.c.
︙ | ︙ | |||
239 240 241 242 243 244 245 | blob_read_link(&disk, zOPath); }else{ blob_read_from_file(&disk, zOPath); } content_get(rid, &a); blob_delta_apply(&a, &delta, &b); if( isLink == isNewLink && blob_compare(&disk, &a)==0 ){ | < < < < | < < < | 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 | blob_read_link(&disk, zOPath); }else{ blob_read_from_file(&disk, zOPath); } content_get(rid, &a); blob_delta_apply(&a, &delta, &b); if( isLink == isNewLink && blob_compare(&disk, &a)==0 ){ checked_symlink_create(1, isLink, isNewLink, &b, zNPath); file_wd_setexe(zNPath, isExec); fossil_print("UPDATE %s\n", zNew); }else{ int rc; if( isLink || isNewLink ){ rc = -1; blob_zero(&b); /* because we reset it later */ |
︙ | ︙ |
Changes to src/undo.c.
︙ | ︙ | |||
68 69 70 71 72 73 74 | } if( old_exists ){ if( new_exists ){ fossil_print("%s %s\n", redoFlag ? "REDO" : "UNDO", zPathname); }else{ fossil_print("NEW %s\n", zPathname); } | < < < < < < | < | 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 | } if( old_exists ){ if( new_exists ){ fossil_print("%s %s\n", redoFlag ? "REDO" : "UNDO", zPathname); }else{ fossil_print("NEW %s\n", zPathname); } checked_symlink_create(new_exists, old_link, new_link, &new, zFullname); file_wd_setexe(zFullname, old_exe); }else{ fossil_print("DELETE %s\n", zPathname); file_delete(zFullname); } blob_reset(&new); free(zFullname); |
︙ | ︙ |
Changes to src/update.c.
︙ | ︙ | |||
806 807 808 809 810 811 812 | " WHERE pathname=%Q AND origname!=pathname;" "DELETE FROM vfile WHERE pathname=%Q", zFile, zFile ); }else{ sqlite3_int64 mtime; undo_save(zFile); | | < < < < < < < | 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 | " WHERE pathname=%Q AND origname!=pathname;" "DELETE FROM vfile WHERE pathname=%Q", zFile, zFile ); }else{ sqlite3_int64 mtime; undo_save(zFile); checked_symlink_create(file_wd_size(zFull)>=0, isLink, file_wd_islink(zFull), &record, zFull); file_wd_setexe(zFull, isExe); fossil_print("REVERTED: %s\n", zFile); mtime = file_wd_mtime(zFull); db_multi_exec( "UPDATE vfile" " SET mtime=%lld, chnged=0, deleted=0, isexe=%d, islink=%d,mrid=rid" " WHERE pathname=%Q OR origname=%Q", |
︙ | ︙ |
Changes to src/vfile.c.
︙ | ︙ | |||
318 319 320 321 322 323 324 | } } if( verbose ) fossil_print("%s\n", &zName[nRepos]); if( file_wd_isdir(zName) == 1 ){ /*TODO(dchest): remove directories? */ fossil_fatal("%s is directory, cannot overwrite\n", zName); } | | < < < < < < < | 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 | } } if( verbose ) fossil_print("%s\n", &zName[nRepos]); if( file_wd_isdir(zName) == 1 ){ /*TODO(dchest): remove directories? */ fossil_fatal("%s is directory, cannot overwrite\n", zName); } checked_symlink_create(file_wd_size(zName)>=0, isLink, file_wd_islink(zName), &content, zName); file_wd_setexe(zName, isExe); blob_reset(&content); db_multi_exec("UPDATE vfile SET mtime=%lld WHERE id=%d", file_wd_mtime(zName), id); } db_finalize(&q); } |
︙ | ︙ |