| 261 | } |
| 262 | |
| 263 | static 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 | |
| 299 | struct extra_file_info { |
| 300 | char *base; |
nothing calls this directly
no test coverage detected