| 413 | } |
| 414 | |
| 415 | const char *setup_temporary_shallow(const struct oid_array *extra) |
| 416 | { |
| 417 | struct tempfile *temp; |
| 418 | struct strbuf sb = STRBUF_INIT; |
| 419 | |
| 420 | if (write_shallow_commits(&sb, 0, extra)) { |
| 421 | char *path = repo_git_path(the_repository, "shallow_XXXXXX"); |
| 422 | temp = xmks_tempfile(path); |
| 423 | free(path); |
| 424 | |
| 425 | if (write_in_full(temp->fd, sb.buf, sb.len) < 0 || |
| 426 | close_tempfile_gently(temp) < 0) |
| 427 | die_errno("failed to write to %s", |
| 428 | get_tempfile_path(temp)); |
| 429 | strbuf_release(&sb); |
| 430 | return get_tempfile_path(temp); |
| 431 | } |
| 432 | /* |
| 433 | * is_repository_shallow() sees empty string as "no shallow |
| 434 | * file". |
| 435 | */ |
| 436 | return ""; |
| 437 | } |
| 438 | |
| 439 | void setup_alternate_shallow(struct shallow_lock *shallow_lock, |
| 440 | const char **alternate_shallow_file, |
no test coverage detected