282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
|
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
|
-
-
+
+
+
|
printf("%s\n", blob_buffer(&x));
blob_reset(&x);
}
}
/*
** Compute a pathname for a file relative to the root of the local
** tree. Return TRUE on success and FALSE if the file is not contained
** in the local tree.
** tree. Return TRUE on success. On failure, print and error
** message and quit.
**
** The root of the tree is defined by the g.zLocalRoot variable.
*/
int file_tree_name(const char *zOrigName, Blob *pOut){
int 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) ){
blob_reset(&full);
fossil_fatal("file outside of checkout tree: %s", zOrigName);
return 0;
}
blob_zero(pOut);
blob_append(pOut, blob_buffer(&full)+n, blob_size(&full)-n);
return 1;
}
|