Add missing headers to prevent ill-effects from multiple inclusion.
Found by the LGTM source code analyzer.
Signed-off-by: Elia Pinto <gitter.spiros@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
... and use it initially to write global extended header records.
Improvements compared to the old write_header():
- Uses a struct ustar_header instead of hardcoded offsets.
- Takes one struct strbuf as path argument instead of a (basedir,
prefix, name) tuple.
- Not only writes the tar header, but also the contents of the
file, if any.
- Does not write directly into the ring buffer. This allows the
code to be layed out more naturally, because there is no more
ordering constraint. Before we had to first finish writing the
extended header, now we can construct the extended and normal
headers in parallel.
- The typeflag parameter has been replaced by (reasonable) magic
values. path == NULL indicates an extended header, additionally
sha1 == NULL means it is a global extended header.
Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx>
Signed-off-by: Junio C Hamano <junkio@cox.net>