builtin/repack.c: introduce `struct write_pack_opts`

There are various functions within the 'repack' builtin which are
responsible for writing different kinds of packs. They include:

 - `static int write_filtered_pack(...)`
 - `static int write_cruft_pack(...)`

as well as the function `finish_pack_objects_cmd()`, which is
responsible for finalizing a new pack write, and recording the checksum
of its contents in the 'names' list.

Both of these `write_` functions have a few things in common. They both
take a pointer to the 'pack_objects_args' struct, as well as a pair of
character pointers for `destination` and `pack_prefix`.

Instead of repeating those arguments for each function, let's extract an
options struct called "write_pack_opts" which has these three parameters
as member fields. While we're at it, add fields for "packdir," and
"packtmp", both of which are static variables within the builtin, and
need to be read from within these two functions.

This will shorten the list of parameters that callers have to provide to
`write_filtered_pack()`, avoid ambiguity when passing multiple variables
of the same type, and provide a unified interface for the two functions
mentioned earlier.

(Note that "pack_prefix" can be derived on the fly as a function of
"packdir" and "packtmp", making it unnecessary to store "pack_prefix"
explicitly. This commit ignores that potential cleanup in the name of
doing as few things as possible, but a later commit will make that
change.)

Signed-off-by: Taylor Blau <me@ttaylorr.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 files changed
tree: 116965e728eff1c2b834387215c430296fb9c25a
  1. .github/
  2. bin-wrappers/
  3. block-sha1/
  4. builtin/
  5. ci/
  6. compat/
  7. compiler-tricks/
  8. contrib/
  9. Documentation/
  10. ewah/
  11. git-gui/
  12. gitk-git/
  13. gitweb/
  14. mergetools/
  15. negotiator/
  16. oss-fuzz/
  17. perl/
  18. po/
  19. refs/
  20. reftable/
  21. sha1/
  22. sha1dc/
  23. sha256/
  24. subprojects/
  25. t/
  26. templates/
  27. trace2/
  28. xdiff/
  29. .cirrus.yml
  30. .clang-format
  31. .editorconfig
  32. .gitattributes
  33. .gitignore
  34. .gitlab-ci.yml
  35. .gitmodules
  36. .mailmap
  37. .tsan-suppressions
  38. abspath.c
  39. abspath.h
  40. aclocal.m4
  41. add-interactive.c
  42. add-interactive.h
  43. add-patch.c
  44. advice.c
  45. advice.h
  46. alias.c
  47. alias.h
  48. alloc.c
  49. alloc.h
  50. apply.c
  51. apply.h
  52. archive-tar.c
  53. archive-zip.c
  54. archive.c
  55. archive.h
  56. attr.c
  57. attr.h
  58. banned.h
  59. base85.c
  60. base85.h
  61. bisect.c
  62. bisect.h
  63. blame.c
  64. blame.h
  65. blob.c
  66. blob.h
  67. bloom.c
  68. bloom.h
  69. branch.c
  70. branch.h
  71. builtin.h
  72. bulk-checkin.c
  73. bulk-checkin.h
  74. bundle-uri.c
  75. bundle-uri.h
  76. bundle.c
  77. bundle.h
  78. cache-tree.c
  79. cache-tree.h
  80. cbtree.c
  81. cbtree.h
  82. chdir-notify.c
  83. chdir-notify.h
  84. check-builtins.sh
  85. checkout.c
  86. checkout.h
  87. chunk-format.c
  88. chunk-format.h
  89. CODE_OF_CONDUCT.md
  90. color.c
  91. color.h
  92. column.c
  93. column.h
  94. combine-diff.c
  95. command-list.txt
  96. commit-graph.c
  97. commit-graph.h
  98. commit-reach.c
  99. commit-reach.h
  100. commit-slab-decl.h
  101. commit-slab-impl.h
  102. commit-slab.h
  103. commit.c
  104. commit.h
  105. common-exit.c
  106. common-init.c
  107. common-init.h
  108. common-main.c
  109. config.c
  110. config.h
  111. config.mak.dev
  112. config.mak.in
  113. config.mak.uname
  114. configure.ac
  115. connect.c
  116. connect.h
  117. connected.c
  118. connected.h
  119. convert.c
  120. convert.h
  121. copy.c
  122. copy.h
  123. COPYING
  124. credential.c
  125. credential.h
  126. csum-file.c
  127. csum-file.h
  128. ctype.c
  129. daemon.c
  130. date.c
  131. date.h
  132. decorate.c
  133. decorate.h
  134. delta-islands.c
  135. delta-islands.h
  136. delta.h
  137. detect-compiler
  138. diagnose.c
  139. diagnose.h
  140. diff-delta.c
  141. diff-lib.c
  142. diff-merges.c
  143. diff-merges.h
  144. diff-no-index.c
  145. diff.c
  146. diff.h
  147. diffcore-break.c
  148. diffcore-delta.c
  149. diffcore-order.c
  150. diffcore-pickaxe.c
  151. diffcore-rename.c
  152. diffcore-rotate.c
  153. diffcore.h
  154. dir-iterator.c
  155. dir-iterator.h
  156. dir.c
  157. dir.h
  158. editor.c
  159. editor.h
  160. entry.c
  161. entry.h
  162. environment.c
  163. environment.h
  164. exec-cmd.c
  165. exec-cmd.h
  166. fetch-negotiator.c
  167. fetch-negotiator.h
  168. fetch-pack.c
  169. fetch-pack.h
  170. fmt-merge-msg.c
  171. fmt-merge-msg.h
  172. for-each-ref.h
  173. fsck.c
  174. fsck.h
  175. fsmonitor--daemon.h
  176. fsmonitor-ipc.c
  177. fsmonitor-ipc.h
  178. fsmonitor-ll.h
  179. fsmonitor-path-utils.h
  180. fsmonitor-settings.c
  181. fsmonitor-settings.h
  182. fsmonitor.c
  183. fsmonitor.h
  184. generate-cmdlist.sh
  185. generate-configlist.sh
  186. generate-hooklist.sh
  187. generate-perl.sh
  188. generate-python.sh
  189. generate-script.sh
  190. gettext.c
  191. gettext.h
  192. git-archimport.perl
  193. GIT-BUILD-OPTIONS.in
  194. git-compat-util.h
  195. git-curl-compat.h
  196. git-cvsexportcommit.perl
  197. git-cvsimport.perl
  198. git-cvsserver.perl
  199. git-difftool--helper.sh
  200. git-filter-branch.sh
  201. git-instaweb.sh
  202. git-merge-octopus.sh
  203. git-merge-one-file.sh
  204. git-merge-resolve.sh
  205. git-mergetool--lib.sh
  206. git-mergetool.sh
  207. git-p4.py
  208. git-quiltimport.sh
  209. git-request-pull.sh
  210. git-send-email.perl
  211. git-sh-i18n.sh
  212. git-sh-setup.sh
  213. git-submodule.sh
  214. git-svn.perl
  215. GIT-VERSION-FILE.in
  216. GIT-VERSION-GEN
  217. git-web--browse.sh
  218. git-zlib.c
  219. git-zlib.h
  220. git.c
  221. git.rc.in
  222. gpg-interface.c
  223. gpg-interface.h
  224. graph.c
  225. graph.h
  226. grep.c
  227. grep.h
  228. hash-lookup.c
  229. hash-lookup.h
  230. hash.c
  231. hash.h
  232. hashmap.c
  233. hashmap.h
  234. help.c
  235. help.h
  236. hex-ll.c
  237. hex-ll.h
  238. hex.c
  239. hex.h
  240. hook.c
  241. hook.h
  242. http-backend.c
  243. http-fetch.c
  244. http-push.c
  245. http-walker.c
  246. http.c
  247. http.h
  248. ident.c
  249. ident.h
  250. imap-send.c
  251. INSTALL
  252. iterator.h
  253. json-writer.c
  254. json-writer.h
  255. khash.h
  256. kwset.c
  257. kwset.h
  258. levenshtein.c
  259. levenshtein.h
  260. LGPL-2.1
  261. line-log.c
  262. line-log.h
  263. line-range.c
  264. line-range.h
  265. linear-assignment.c
  266. linear-assignment.h
  267. list-objects-filter-options.c
  268. list-objects-filter-options.h
  269. list-objects-filter.c
  270. list-objects-filter.h
  271. list-objects.c
  272. list-objects.h
  273. list.h
  274. lockfile.c
  275. lockfile.h
  276. log-tree.c
  277. log-tree.h
  278. loose.c
  279. loose.h
  280. ls-refs.c
  281. ls-refs.h
  282. mailinfo.c
  283. mailinfo.h
  284. mailmap.c
  285. mailmap.h
  286. Makefile
  287. match-trees.c
  288. match-trees.h
  289. mem-pool.c
  290. mem-pool.h
  291. merge-blobs.c
  292. merge-blobs.h
  293. merge-ll.c
  294. merge-ll.h
  295. merge-ort-wrappers.c
  296. merge-ort-wrappers.h
  297. merge-ort.c
  298. merge-ort.h
  299. merge.c
  300. merge.h
  301. mergesort.h
  302. meson.build
  303. meson_options.txt
  304. midx-write.c
  305. midx.c
  306. midx.h
  307. name-hash.c
  308. name-hash.h
  309. notes-cache.c
  310. notes-cache.h
  311. notes-merge.c
  312. notes-merge.h
  313. notes-utils.c
  314. notes-utils.h
  315. notes.c
  316. notes.h
  317. object-file-convert.c
  318. object-file-convert.h
  319. object-file.c
  320. object-file.h
  321. object-name.c
  322. object-name.h
  323. object.c
  324. object.h
  325. odb.c
  326. odb.h
  327. oid-array.c
  328. oid-array.h
  329. oidmap.c
  330. oidmap.h
  331. oidset.c
  332. oidset.h
  333. oidtree.c
  334. oidtree.h
  335. pack-bitmap-write.c
  336. pack-bitmap.c
  337. pack-bitmap.h
  338. pack-check.c
  339. pack-mtimes.c
  340. pack-mtimes.h
  341. pack-objects.c
  342. pack-objects.h
  343. pack-revindex.c
  344. pack-revindex.h
  345. pack-write.c
  346. pack.h
  347. packfile.c
  348. packfile.h
  349. pager.c
  350. pager.h
  351. parallel-checkout.c
  352. parallel-checkout.h
  353. parse-options-cb.c
  354. parse-options.c
  355. parse-options.h
  356. parse.c
  357. parse.h
  358. patch-delta.c
  359. patch-ids.c
  360. patch-ids.h
  361. path-walk.c
  362. path-walk.h
  363. path.c
  364. path.h
  365. pathspec.c
  366. pathspec.h
  367. pkt-line.c
  368. pkt-line.h
  369. preload-index.c
  370. preload-index.h
  371. pretty.c
  372. pretty.h
  373. prio-queue.c
  374. prio-queue.h
  375. progress.c
  376. progress.h
  377. promisor-remote.c
  378. promisor-remote.h
  379. prompt.c
  380. prompt.h
  381. protocol-caps.c
  382. protocol-caps.h
  383. protocol.c
  384. protocol.h
  385. prune-packed.c
  386. prune-packed.h
  387. pseudo-merge.c
  388. pseudo-merge.h
  389. quote.c
  390. quote.h
  391. range-diff.c
  392. range-diff.h
  393. reachable.c
  394. reachable.h
  395. read-cache-ll.h
  396. read-cache.c
  397. read-cache.h
  398. README.md
  399. rebase-interactive.c
  400. rebase-interactive.h
  401. rebase.c
  402. rebase.h
  403. ref-filter.c
  404. ref-filter.h
  405. reflog-walk.c
  406. reflog-walk.h
  407. reflog.c
  408. reflog.h
  409. refs.c
  410. refs.h
  411. refspec.c
  412. refspec.h
  413. remote-curl.c
  414. remote.c
  415. remote.h
  416. repack-geometry.c
  417. repack-midx.c
  418. repack-promisor.c
  419. repack.c
  420. repack.h
  421. replace-object.c
  422. replace-object.h
  423. repo-settings.c
  424. repo-settings.h
  425. repository.c
  426. repository.h
  427. rerere.c
  428. rerere.h
  429. reset.c
  430. reset.h
  431. resolve-undo.c
  432. resolve-undo.h
  433. revision.c
  434. revision.h
  435. run-command.c
  436. run-command.h
  437. sane-ctype.h
  438. scalar.c
  439. SECURITY.md
  440. send-pack.c
  441. send-pack.h
  442. sequencer.c
  443. sequencer.h
  444. serve.c
  445. serve.h
  446. server-info.c
  447. server-info.h
  448. setup.c
  449. setup.h
  450. sh-i18n--envsubst.c
  451. sha1dc_git.c
  452. sha1dc_git.h
  453. shallow.c
  454. shallow.h
  455. shared.mak
  456. shell.c
  457. shortlog.h
  458. sideband.c
  459. sideband.h
  460. sigchain.c
  461. sigchain.h
  462. simple-ipc.h
  463. sparse-index.c
  464. sparse-index.h
  465. split-index.c
  466. split-index.h
  467. stable-qsort.c
  468. statinfo.c
  469. statinfo.h
  470. strbuf.c
  471. strbuf.h
  472. streaming.c
  473. streaming.h
  474. string-list.c
  475. string-list.h
  476. strmap.c
  477. strmap.h
  478. strvec.c
  479. strvec.h
  480. sub-process.c
  481. sub-process.h
  482. submodule-config.c
  483. submodule-config.h
  484. submodule.c
  485. submodule.h
  486. symlinks.c
  487. symlinks.h
  488. tag.c
  489. tag.h
  490. tar.h
  491. tempfile.c
  492. tempfile.h
  493. thread-utils.c
  494. thread-utils.h
  495. tmp-objdir.c
  496. tmp-objdir.h
  497. trace.c
  498. trace.h
  499. trace2.c
  500. trace2.h
  501. trailer.c
  502. trailer.h
  503. transport-helper.c
  504. transport-internal.h
  505. transport.c
  506. transport.h
  507. tree-diff.c
  508. tree-walk.c
  509. tree-walk.h
  510. tree.c
  511. tree.h
  512. unicode-width.h
  513. unimplemented.sh
  514. unix-socket.c
  515. unix-socket.h
  516. unix-stream-server.c
  517. unix-stream-server.h
  518. unpack-trees.c
  519. unpack-trees.h
  520. upload-pack.c
  521. upload-pack.h
  522. url.c
  523. url.h
  524. urlmatch.c
  525. urlmatch.h
  526. usage.c
  527. userdiff.c
  528. userdiff.h
  529. utf8.c
  530. utf8.h
  531. varint.c
  532. varint.h
  533. version-def.h.in
  534. version.c
  535. version.h
  536. versioncmp.c
  537. versioncmp.h
  538. walker.c
  539. walker.h
  540. wildmatch.c
  541. wildmatch.h
  542. worktree.c
  543. worktree.h
  544. wrapper.c
  545. wrapper.h
  546. write-or-die.c
  547. write-or-die.h
  548. ws.c
  549. ws.h
  550. wt-status.c
  551. wt-status.h
  552. xdiff-interface.c
  553. xdiff-interface.h
README.md

Build status

Git - fast, scalable, distributed revision control system

Git is a fast, scalable, distributed revision control system with an unusually rich command set that provides both high-level operations and full access to internals.

Git is an Open Source project covered by the GNU General Public License version 2 (some parts of it are under different licenses, compatible with the GPLv2). It was originally written by Linus Torvalds with help of a group of hackers around the net.

Please read the file INSTALL for installation instructions.

Many Git online resources are accessible from https://git-scm.com/ including full documentation and Git related tools.

See Documentation/gittutorial.adoc to get started, then see Documentation/giteveryday.adoc for a useful minimum set of commands, and Documentation/git-<commandname>.adoc for documentation of each command. If git has been correctly installed, then the tutorial can also be read with man gittutorial or git help tutorial, and the documentation of each command with man git-<commandname> or git help <commandname>.

CVS users may also want to read Documentation/gitcvs-migration.adoc (man gitcvs-migration or git help cvs-migration if git is installed).

The user discussion and development of Git take place on the Git mailing list -- everyone is welcome to post bug reports, feature requests, comments and patches to git@vger.kernel.org (read Documentation/SubmittingPatches for instructions on patch submission and Documentation/CodingGuidelines).

Those wishing to help with error message, usage and informational message string translations (localization l10) should see po/README.md (a po file is a Portable Object file that holds the translations).

To subscribe to the list, send an email to git+subscribe@vger.kernel.org (see https://subspace.kernel.org/subscribing.html for details). The mailing list archives are available at https://lore.kernel.org/git/, https://marc.info/?l=git and other archival sites.

Issues which are security relevant should be disclosed privately to the Git Security mailing list git-security@googlegroups.com.

The maintainer frequently sends the “What's cooking” reports that list the current status of various development topics to the mailing list. The discussion following them give a good reference for project status, development direction and remaining tasks.

The name “git” was given by Linus Torvalds when he wrote the very first version. He described the tool as “the stupid content tracker” and the name as (depending on your mood):

  • random three-letter combination that is pronounceable, and not actually used by any common UNIX command. The fact that it is a mispronunciation of “get” may or may not be relevant.
  • stupid. contemptible and despicable. simple. Take your pick from the dictionary of slang.
  • “global information tracker”: you're in a good mood, and it actually works for you. Angels sing, and a light suddenly fills the room.
  • “goddamn idiotic truckload of sh*t”: when it breaks