Skip to content

Commit

Permalink
index-pack: be careful after fixing up the header/footer
Browse files Browse the repository at this point in the history
The index-pack command, when processing a thin pack, fixed up the pack
after-the-fact.  It forgets to fsync the result, because it only did that
in one path rather in all cases of fixup.

This moves the fsync_or_die() to the fix-up routine itself, rather than
doing it in one of the callers, so that all cases are covered.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
  • Loading branch information
Linus Torvalds authored and Junio C Hamano committed Aug 27, 2008
1 parent d0b92a3 commit 0c68d38
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 1 deletion.
1 change: 0 additions & 1 deletion builtin-pack-objects.c
Original file line number Diff line number Diff line change
Expand Up @@ -499,7 +499,6 @@ static void write_pack_file(void)
} else {
int fd = sha1close(f, NULL, 0);
fixup_pack_header_footer(fd, sha1, pack_tmp_name, nr_written);
fsync_or_die(fd, pack_tmp_name);
close(fd);
}

Expand Down
1 change: 1 addition & 0 deletions pack-write.c
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,7 @@ void fixup_pack_header_footer(int pack_fd,

SHA1_Final(pack_file_sha1, &c);
write_or_die(pack_fd, pack_file_sha1, 20);
fsync_or_die(pack_fd, pack_name);
}

char *index_pack_lockfile(int ip_out)
Expand Down

0 comments on commit 0c68d38

Please sign in to comment.