string if the root is passed in. Without this, the call to get the tree at the root would fail with a "out of checkout tree" message.
--- src/file.c
+++ src/file.c
@@ -356,23 +356,26 @@
** false, then simply return 0.
**
** The root of the tree is defined by the g.zLocalRoot variable.
*/
int file_tree_name(const char *zOrigName, Blob *pOut, int errFatal){
- int n;
+ int m,n;
Blob full;
db_must_be_within_tree();
file_canonical_name(zOrigName, &full);
n = strlen(g.zLocalRoot);
- if( blob_size(&full)<=n || memcmp(g.zLocalRoot, blob_buffer(&full), n) ){
+ m = blob_size(&full);
+ if( m
blob_reset(&full);
if( errFatal ){
fossil_fatal("file outside of checkout tree: %s", zOrigName);
}
return 0;
}
blob_zero(pOut);
+ if (m == n - 1)
+ return 1;
blob_append(pOut, blob_buffer(&full)+n, blob_size(&full)-n);
return 1;
}