diff options
| author | Junio C Hamano <gitster@pobox.com> | 2022-01-03 16:24:14 -0800 |
|---|---|---|
| committer | Junio C Hamano <gitster@pobox.com> | 2022-01-03 16:24:15 -0800 |
| commit | 0dc90d954db852c6604796b8d817365f94e92a16 (patch) | |
| tree | 9d4cf45af85370e4e7c89e74ff6ba74b39a28579 /builtin | |
| parent | Merge branch 'jc/unleak-log' (diff) | |
| parent | tmp-objdir: disable ref updates when replacing the primary odb (diff) | |
| download | git-0dc90d954db852c6604796b8d817365f94e92a16.tar.gz git-0dc90d954db852c6604796b8d817365f94e92a16.zip | |
Merge branch 'ns/tmp-objdir'
New interface into the tmp-objdir API to help in-core use of the
quarantine feature.
* ns/tmp-objdir:
tmp-objdir: disable ref updates when replacing the primary odb
tmp-objdir: new API for creating temporary writable databases
Diffstat (limited to 'builtin')
| -rw-r--r-- | builtin/prune.c | 20 | ||||
| -rw-r--r-- | builtin/receive-pack.c | 2 |
2 files changed, 17 insertions, 5 deletions
diff --git a/builtin/prune.c b/builtin/prune.c index 485c9a3c56..c2bcdc07db 100644 --- a/builtin/prune.c +++ b/builtin/prune.c @@ -26,10 +26,22 @@ static int prune_tmp_file(const char *fullpath) return error("Could not stat '%s'", fullpath); if (st.st_mtime > expire) return 0; - if (show_only || verbose) - printf("Removing stale temporary file %s\n", fullpath); - if (!show_only) - unlink_or_warn(fullpath); + if (S_ISDIR(st.st_mode)) { + if (show_only || verbose) + printf("Removing stale temporary directory %s\n", fullpath); + if (!show_only) { + struct strbuf remove_dir_buf = STRBUF_INIT; + + strbuf_addstr(&remove_dir_buf, fullpath); + remove_dir_recursively(&remove_dir_buf, 0); + strbuf_release(&remove_dir_buf); + } + } else { + if (show_only || verbose) + printf("Removing stale temporary file %s\n", fullpath); + if (!show_only) + unlink_or_warn(fullpath); + } return 0; } diff --git a/builtin/receive-pack.c b/builtin/receive-pack.c index 4f92e6f059..9f4a0b816c 100644 --- a/builtin/receive-pack.c +++ b/builtin/receive-pack.c @@ -2206,7 +2206,7 @@ static const char *unpack(int err_fd, struct shallow_info *si) strvec_push(&child.args, alt_shallow_file); } - tmp_objdir = tmp_objdir_create(); + tmp_objdir = tmp_objdir_create("incoming"); if (!tmp_objdir) { if (err_fd > 0) close(err_fd); |
