mirror of
https://github.com/git/git
synced 2024-08-27 19:49:21 +00:00
Don't create a final empty packfile in fast-import.
If the last packfile is going to be empty (has 0 objects) then it shouldn't be kept after the import has terminated, as there is no point to the packfile. So rather than hashing it and making the index file, just delete the packfile. Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
This commit is contained in:
parent
7bfe6e2613
commit
3e005baf85
|
@ -713,6 +713,7 @@ static void end_packfile()
|
|||
{
|
||||
struct packed_git *old_p = pack_data, *new_p;
|
||||
|
||||
if (object_count) {
|
||||
fixup_header_footer();
|
||||
write_index(idx_name);
|
||||
|
||||
|
@ -724,6 +725,11 @@ static void end_packfile()
|
|||
new_p->pack_fd = old_p->pack_fd;
|
||||
all_packs[pack_id++] = new_p;
|
||||
install_packed_git(new_p);
|
||||
}
|
||||
else {
|
||||
close(pack_fd);
|
||||
unlink(old_p->pack_name);
|
||||
}
|
||||
free(old_p);
|
||||
free(idx_name);
|
||||
|
||||
|
|
Loading…
Reference in a new issue