| 243 | } |
| 244 | |
| 245 | static int write_directory(struct archiver_context *c) |
| 246 | { |
| 247 | struct directory *d = c->bottom; |
| 248 | int ret; |
| 249 | |
| 250 | if (!d) |
| 251 | return 0; |
| 252 | c->bottom = d->up; |
| 253 | d->path[d->len - 1] = '\0'; /* no trailing slash */ |
| 254 | ret = |
| 255 | write_directory(c) || |
| 256 | write_archive_entry(&d->oid, d->path, d->baselen, |
| 257 | d->path + d->baselen, d->mode, |
| 258 | c) != READ_TREE_RECURSIVE; |
| 259 | free(d); |
| 260 | return ret ? -1 : 0; |
| 261 | } |
| 262 | |
| 263 | static int queue_or_write_archive_entry(const struct object_id *oid, |
| 264 | struct strbuf *base, const char *filename, |
no test coverage detected