Fossil SCM
Allow fossil update -n -v current to be used on the root directory (aborted with "outside of checkout tree" error before).
Commit
b6bb1ee725ccf13bd9a9fd34851c65a6cc6644f0
Parent
c18bbf69eb7730f…
1 file changed
+9
-8
+9
-8
| --- src/file.c | ||
| +++ src/file.c | ||
| @@ -432,20 +432,21 @@ | ||
| 432 | 432 | int n; |
| 433 | 433 | Blob full; |
| 434 | 434 | db_must_be_within_tree(); |
| 435 | 435 | file_canonical_name(zOrigName, &full); |
| 436 | 436 | n = strlen(g.zLocalRoot); |
| 437 | - if( blob_size(&full)<=n || memcmp(g.zLocalRoot, blob_buffer(&full), n) ){ | |
| 438 | - blob_reset(&full); | |
| 439 | - if( errFatal ){ | |
| 437 | + if((blob_size(&full) == n-1 && !memcmp(g.zLocalRoot, blob_buffer(&full), n-1)) || | |
| 438 | + (blob_size(&full) >= n && !memcmp(g.zLocalRoot, blob_buffer(&full), n))){ | |
| 439 | + blob_zero(pOut); | |
| 440 | + blob_append(pOut, blob_buffer(&full)+n, blob_size(&full)-n); | |
| 441 | + return 1; | |
| 442 | + } | |
| 443 | + blob_reset(&full); | |
| 444 | + if( errFatal ){ | |
| 440 | 445 | fossil_fatal("file outside of checkout tree: %s", zOrigName); |
| 441 | - } | |
| 442 | - return 0; | |
| 443 | 446 | } |
| 444 | - blob_zero(pOut); | |
| 445 | - blob_append(pOut, blob_buffer(&full)+n, blob_size(&full)-n); | |
| 446 | - return 1; | |
| 447 | + return 0; | |
| 447 | 448 | } |
| 448 | 449 | |
| 449 | 450 | /* |
| 450 | 451 | ** COMMAND: test-tree-name |
| 451 | 452 | ** |
| 452 | 453 |
| --- src/file.c | |
| +++ src/file.c | |
| @@ -432,20 +432,21 @@ | |
| 432 | int n; |
| 433 | Blob full; |
| 434 | db_must_be_within_tree(); |
| 435 | file_canonical_name(zOrigName, &full); |
| 436 | n = strlen(g.zLocalRoot); |
| 437 | if( blob_size(&full)<=n || memcmp(g.zLocalRoot, blob_buffer(&full), n) ){ |
| 438 | blob_reset(&full); |
| 439 | if( errFatal ){ |
| 440 | fossil_fatal("file outside of checkout tree: %s", zOrigName); |
| 441 | } |
| 442 | return 0; |
| 443 | } |
| 444 | blob_zero(pOut); |
| 445 | blob_append(pOut, blob_buffer(&full)+n, blob_size(&full)-n); |
| 446 | return 1; |
| 447 | } |
| 448 | |
| 449 | /* |
| 450 | ** COMMAND: test-tree-name |
| 451 | ** |
| 452 |
| --- src/file.c | |
| +++ src/file.c | |
| @@ -432,20 +432,21 @@ | |
| 432 | int n; |
| 433 | Blob full; |
| 434 | db_must_be_within_tree(); |
| 435 | file_canonical_name(zOrigName, &full); |
| 436 | n = strlen(g.zLocalRoot); |
| 437 | if((blob_size(&full) == n-1 && !memcmp(g.zLocalRoot, blob_buffer(&full), n-1)) || |
| 438 | (blob_size(&full) >= n && !memcmp(g.zLocalRoot, blob_buffer(&full), n))){ |
| 439 | blob_zero(pOut); |
| 440 | blob_append(pOut, blob_buffer(&full)+n, blob_size(&full)-n); |
| 441 | return 1; |
| 442 | } |
| 443 | blob_reset(&full); |
| 444 | if( errFatal ){ |
| 445 | fossil_fatal("file outside of checkout tree: %s", zOrigName); |
| 446 | } |
| 447 | return 0; |
| 448 | } |
| 449 | |
| 450 | /* |
| 451 | ** COMMAND: test-tree-name |
| 452 | ** |
| 453 |