| | @@ -500,10 +500,20 @@ |
| 500 | 500 | ** Rename a single file. |
| 501 | 501 | ** |
| 502 | 502 | ** The original name of the file is zOrig. The new filename is zNew. |
| 503 | 503 | */ |
| 504 | 504 | static void mv_one_file(int vid, const char *zOrig, const char *zNew){ |
| 505 | + int x = db_int(-1, "SELECT deleted FROM vfile WHERE pathname=%Q", zNew); |
| 506 | + if( x>=0 ){ |
| 507 | + if( x==0 ){ |
| 508 | + fossil_fatal("cannot rename '%s' to '%s' since another file named '%s'" |
| 509 | + " is currently under management", zOrig, zNew, zNew); |
| 510 | + }else{ |
| 511 | + fossil_fatal("cannot rename '%s' to '%s' since the delete of '%s' has " |
| 512 | + "not yet been committed", zOrig, zNew, zNew); |
| 513 | + } |
| 514 | + } |
| 505 | 515 | fossil_print("RENAME %s %s\n", zOrig, zNew); |
| 506 | 516 | db_multi_exec( |
| 507 | 517 | "UPDATE vfile SET pathname='%q' WHERE pathname='%q' AND vid=%d", |
| 508 | 518 | zNew, zOrig, vid |
| 509 | 519 | ); |
| 510 | 520 | |