path: root/packfile.h
diff options
authorDerrick Stolee <>2019-06-10 23:35:22 (GMT)
committerJunio C Hamano <>2019-06-11 17:34:40 (GMT)
commit8434e85d5f9602a82f6b34ba82a9cb9e559a2d3b (patch)
tree47a5ca23b44ebf9b369585a6b24eb5a49f5f12ea /packfile.h
parentb697d92f56511e804b8ba20ccbe7bdc85dc66810 (diff)
repack: refactor pack deletion for future use
The repack builtin deletes redundant pack-files and their associated .idx, .promisor, .bitmap, and .keep files. We will want to re-use this logic in the future for other types of repack, so pull the logic into 'unlink_pack_path()' in packfile.c. The 'ignore_keep' parameter is enabled for the use in repack, but will be important for a future caller. Signed-off-by: Derrick Stolee <> Signed-off-by: Junio C Hamano <>
Diffstat (limited to 'packfile.h')
1 files changed, 7 insertions, 0 deletions
diff --git a/packfile.h b/packfile.h
index b678d35..3c436c1 100644
--- a/packfile.h
+++ b/packfile.h
@@ -96,6 +96,13 @@ void clear_delta_base_cache(void);
struct packed_git *add_packed_git(const char *path, size_t path_len, int local);
+ * Unlink the .pack and associated extension files.
+ * Does not unlink if 'force_delete' is false and the pack-file is
+ * marked as ".keep".
+ */
+extern void unlink_pack_path(const char *pack_name, int force_delete);
* Make sure that a pointer access into an mmap'd index file is within bounds,
* and can provide at least 8 bytes of data.