diff options
author | Derrick Stolee <stolee@gmail.com> | 2018-07-12 15:39:40 -0400 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2018-07-20 11:27:29 -0700 |
commit | 525e18c04bb38450e6677bb2aa5c65b78254b5c2 (patch) | |
tree | 4ecc21ed7cc9200580b1e20344681c5ef9420433 /midx.c | |
parent | 17c35c89698c1b9e130ae9a3dc9c016b353308d8 (diff) | |
download | git-525e18c04bb38450e6677bb2aa5c65b78254b5c2.tar.gz |
midx: clear midx on repack
If a 'git repack' command replaces existing packfiles, then we must
clear the existing multi-pack-index before moving the packfiles it
references.
Signed-off-by: Derrick Stolee <dstolee@microsoft.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'midx.c')
-rw-r--r-- | midx.c | 12 |
1 files changed, 12 insertions, 0 deletions
@@ -904,3 +904,15 @@ cleanup: free(midx_name); return 0; } + +void clear_midx_file(const char *object_dir) +{ + char *midx = get_midx_filename(object_dir); + + if (remove_path(midx)) { + UNLEAK(midx); + die(_("failed to clear multi-pack-index at %s"), midx); + } + + free(midx); +} |