Re: [PATCH 1/2] Make pack creation always fsync() the result
On Fri, 30 May 2008, Linus Torvalds wrote:
Show 12 quoted lines
> diff --git a/builtin-pack-objects.c b/builtin-pack-objects.c
> index 70d2f5d..4c2e0cd 100644
> --- a/builtin-pack-objects.c
> +++ b/builtin-pack-objects.c
> @@ -515,10 +515,12 @@ static void write_pack_file(void)
> * If so, rewrite it like in fast-import
> */
> if (pack_to_stdout || nr_written == nr_remaining) {
> - sha1close(f, sha1, 1);
> + unsigned flags = pack_to_stdout ? CSUM_CLOSE : CSUM_FSYNC;
> + sha1close(f, sha1, flags);
> } else {Micro nit: wouldn't it look more obvious if it was written as:
if (pack_to_stdout) {
sha1close(f, sha1, CSUM_CLOSE);
} else if (nr_written == nr_remaining) {
sha1close(f, sha1, CSUM_FSYNC);
} else {
...Otherwise looks sane to me.
Nicolas