tar-tree: Introduce write_entry()

... 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>
2 files changed
tree: c0d9bffe292efeca06b5229b70d289c075cd5f5d
  1. arm/
  2. compat/
  3. contrib/
  4. Documentation/
  5. mozilla-sha1/
  6. ppc/
  7. t/
  8. templates/
  9. .gitignore
  10. apply.c
  11. blame.c
  12. blob.c
  13. blob.h
  14. cache.h
  15. cat-file.c
  16. check-ref-format.c
  17. checkout-index.c
  18. clone-pack.c
  19. combine-diff.c
  20. commit-tree.c
  21. commit.c
  22. commit.h
  23. config.c
  24. connect.c
  25. convert-objects.c
  26. copy.c
  27. COPYING
  28. count-delta.c
  29. count-delta.h
  30. csum-file.c
  31. csum-file.h
  32. ctype.c
  33. daemon.c
  34. date.c
  35. delta.h
  36. describe.c
  37. diff-delta.c
  38. diff-files.c
  39. diff-index.c
  40. diff-stages.c
  41. diff-tree.c
  42. diff.c
  43. diff.h
  44. diffcore-break.c
  45. diffcore-delta.c
  46. diffcore-order.c
  47. diffcore-pathspec.c
  48. diffcore-pickaxe.c
  49. diffcore-rename.c
  50. diffcore.h
  51. entry.c
  52. environment.c
  53. exec_cmd.c
  54. exec_cmd.h
  55. fetch-clone.c
  56. fetch-pack.c
  57. fetch.c
  58. fetch.h
  59. fsck-objects.c
  60. generate-cmdlist.sh
  61. get-tar-commit-id.c
  62. git-add.sh
  63. git-am.sh
  64. git-annotate.perl
  65. git-applymbox.sh
  66. git-applypatch.sh
  67. git-archimport.perl
  68. git-bisect.sh
  69. git-branch.sh
  70. git-checkout.sh
  71. git-cherry.sh
  72. git-clone.sh
  73. git-commit.sh
  74. git-compat-util.h
  75. git-count-objects.sh
  76. git-cvsexportcommit.perl
  77. git-cvsimport.perl
  78. git-cvsserver.perl
  79. git-diff.sh
  80. git-fetch.sh
  81. git-fmt-merge-msg.perl
  82. git-format-patch.sh
  83. git-grep.sh
  84. git-log.sh
  85. git-lost-found.sh
  86. git-ls-remote.sh
  87. git-merge-octopus.sh
  88. git-merge-one-file.sh
  89. git-merge-ours.sh
  90. git-merge-recursive.py
  91. git-merge-resolve.sh
  92. git-merge-stupid.sh
  93. git-merge.sh
  94. git-mv.perl
  95. git-parse-remote.sh
  96. git-prune.sh
  97. git-pull.sh
  98. git-push.sh
  99. git-rebase.sh
  100. git-relink.perl
  101. git-repack.sh
  102. git-request-pull.sh
  103. git-rerere.perl
  104. git-reset.sh
  105. git-resolve.sh
  106. git-revert.sh
  107. git-rm.sh
  108. git-send-email.perl
  109. git-sh-setup.sh
  110. git-shortlog.perl
  111. git-svnimport.perl
  112. git-tag.sh
  113. git-verify-tag.sh
  114. GIT-VERSION-GEN
  115. git-whatchanged.sh
  116. git.c
  117. git.spec.in
  118. gitk
  119. gitMergeCommon.py
  120. hash-object.c
  121. http-fetch.c
  122. http-push.c
  123. http.c
  124. http.h
  125. ident.c
  126. imap-send.c
  127. index-pack.c
  128. index.c
  129. init-db.c
  130. INSTALL
  131. local-fetch.c
  132. ls-files.c
  133. ls-tree.c
  134. mailinfo.c
  135. mailsplit.c
  136. Makefile
  137. merge-base.c
  138. merge-index.c
  139. merge-tree.c
  140. mktag.c
  141. mktree.c
  142. name-rev.c
  143. object.c
  144. object.h
  145. pack-check.c
  146. pack-objects.c
  147. pack-redundant.c
  148. pack.h
  149. pager.c
  150. patch-delta.c
  151. patch-id.c
  152. path.c
  153. peek-remote.c
  154. pkt-line.c
  155. pkt-line.h
  156. prune-packed.c
  157. quote.c
  158. quote.h
  159. read-cache.c
  160. read-tree.c
  161. README
  162. receive-pack.c
  163. refs.c
  164. refs.h
  165. repo-config.c
  166. rev-list.c
  167. rev-parse.c
  168. revision.c
  169. revision.h
  170. rsh.c
  171. rsh.h
  172. run-command.c
  173. run-command.h
  174. send-pack.c
  175. server-info.c
  176. setup.c
  177. sha1_file.c
  178. sha1_name.c
  179. shell.c
  180. show-branch.c
  181. show-index.c
  182. ssh-fetch.c
  183. ssh-pull.c
  184. ssh-push.c
  185. ssh-upload.c
  186. strbuf.c
  187. strbuf.h
  188. stripspace.c
  189. symbolic-ref.c
  190. tag.c
  191. tag.h
  192. tar-tree.c
  193. tar.h
  194. test-date.c
  195. test-delta.c
  196. tree-diff.c
  197. tree.c
  198. tree.h
  199. unpack-file.c
  200. unpack-objects.c
  201. update-index.c
  202. update-ref.c
  203. update-server-info.c
  204. upload-pack.c
  205. usage.c
  206. var.c
  207. verify-pack.c
  208. write-tree.c