Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
| Comment: | 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). |
|---|---|
| Downloads: | Tarball | ZIP archive | SQL archive |
| Timelines: | family | ancestors | descendants | both | bad-winsymlink |
| Files: | files | file ages | folders |
| SHA1: |
31b0a9d737c6417a946c52a014975267 |
| User & Date: | sdr 2014-09-20 18:41:13 |
Context
|
2014-09-21
| ||
| 02:05 | Cleaning up some source comments & such. Also modified a memory block to be on the heap instead of the stack. check-in: 30ff96e7a5 user: sdr tags: bad-winsymlink | |
|
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 | |
Changes
Changes to src/file.c.
| ︙ | ︙ | |||
240 241 242 243 244 245 246 |
Blob content;
blob_set(&content, zTargetFile);
blob_write_to_file(&content, zLinkFile);
blob_reset(&content);
}
}
| | | | | | 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 |
Blob content;
blob_set(&content, zTargetFile);
blob_write_to_file(&content, zLinkFile);
blob_reset(&content);
}
}
void create_symlink_or_file(int mayNeedDelete, int needLink, int mayBeLink, Blob* blob, const char* zName){
if (mayNeedDelete && (needLink || mayBeLink))
link_delete(zName);
if (needLink)
symlink_create(blob_str(blob), zName);
else
blob_write_to_file(blob, zName);
}
/*
** Copy symbolic link from zFrom to zTo.
*/
void symlink_copy(const char *zFrom, const char *zTo){
Blob content;
|
| ︙ | ︙ |
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 ){
create_symlink_or_file(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);
}
create_symlink_or_file(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);
create_symlink_or_file(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);
}
create_symlink_or_file(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);
}
|
| ︙ | ︙ |