MCPcopy Create free account
hub / github.com/git/git / reject_outside

Function reject_outside

archive.c:423–442  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

421}
422
423static int reject_outside(const struct object_id *oid UNUSED,
424 struct strbuf *base, const char *filename,
425 unsigned mode, void *context)
426{
427 struct archiver_args *args = context;
428 struct strbuf buf = STRBUF_INIT;
429 struct strbuf path = STRBUF_INIT;
430 int ret = 0;
431
432 if (S_ISDIR(mode))
433 return READ_TREE_RECURSIVE;
434
435 strbuf_addbuf(&path, base);
436 strbuf_addstr(&path, filename);
437 if (starts_with(relative_path(path.buf, args->prefix, &buf), "../"))
438 ret = -1;
439 strbuf_release(&buf);
440 strbuf_release(&path);
441 return ret;
442}
443
444static int path_exists(struct archiver_args *args, const char *path)
445{

Callers

nothing calls this directly

Calls 5

strbuf_addbufFunction · 0.85
strbuf_addstrFunction · 0.85
starts_withFunction · 0.85
relative_pathFunction · 0.85
strbuf_releaseFunction · 0.85

Tested by

no test coverage detected