MCPcopy Index your code
hub / github.com/git/git / queue_or_write_archive_entry

Function queue_or_write_archive_entry

archive.c:263–297  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

261}
262
263static int queue_or_write_archive_entry(const struct object_id *oid,
264 struct strbuf *base, const char *filename,
265 unsigned mode, void *context)
266{
267 struct archiver_context *c = context;
268
269 while (c->bottom &&
270 !(base->len >= c->bottom->len &&
271 !strncmp(base->buf, c->bottom->path, c->bottom->len))) {
272 struct directory *next = c->bottom->up;
273 free(c->bottom);
274 c->bottom = next;
275 }
276
277 if (S_ISDIR(mode)) {
278 size_t baselen = base->len;
279 const struct attr_check *check;
280
281 /* Borrow base, but restore its original value when done. */
282 strbuf_addstr(base, filename);
283 strbuf_addch(base, '/');
284 check = get_archive_attrs(c->args->repo->index, base->buf);
285 strbuf_setlen(base, baselen);
286
287 if (check_attr_export_ignore(check))
288 return 0;
289 queue_directory(oid, base, filename, mode, c);
290 return READ_TREE_RECURSIVE;
291 }
292
293 if (write_directory(c))
294 return -1;
295 return write_archive_entry(oid, base->buf, base->len, filename, mode,
296 context);
297}
298
299struct extra_file_info {
300 char *base;

Callers

nothing calls this directly

Calls 8

strbuf_addstrFunction · 0.85
strbuf_addchFunction · 0.85
get_archive_attrsFunction · 0.85
strbuf_setlenFunction · 0.85
check_attr_export_ignoreFunction · 0.85
queue_directoryFunction · 0.85
write_directoryFunction · 0.85
write_archive_entryFunction · 0.85

Tested by

no test coverage detected