<feed xmlns='http://www.w3.org/2005/Atom'>
<title>git/Documentation/git-repack.txt, branch v2.48.2</title>
<subtitle>Mirror of https://git.kernel.org/pub/scm/git/git.git/
</subtitle>
<id>https://git.shady.money/git/atom?h=v2.48.2</id>
<link rel='self' href='https://git.shady.money/git/atom?h=v2.48.2'/>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/'/>
<updated>2023-10-29T22:09:57Z</updated>
<entry>
<title>Merge branch 'ps/git-repack-doc-fixes'</title>
<updated>2023-10-29T22:09:57Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2023-10-29T22:09:57Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=39072d24967ec88deec7f46bc0d382d01ec28a0d'/>
<id>urn:sha1:39072d24967ec88deec7f46bc0d382d01ec28a0d</id>
<content type='text'>
Doc updates.

* ps/git-repack-doc-fixes:
  doc/git-repack: don't mention nonexistent "--unpacked" option
  doc/git-repack: fix syntax for `-g` shorthand option
</content>
</entry>
<entry>
<title>Merge branch 'en/docfixes'</title>
<updated>2023-10-23T20:56:37Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2023-10-23T20:56:37Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=d12166d3c8bb12d5a1638c870fc590c4e300a413'/>
<id>urn:sha1:d12166d3c8bb12d5a1638c870fc590c4e300a413</id>
<content type='text'>
Documentation typo and grammo fixes.

* en/docfixes: (25 commits)
  documentation: add missing parenthesis
  documentation: add missing quotes
  documentation: add missing fullstops
  documentation: add some commas where they are helpful
  documentation: fix whitespace issues
  documentation: fix capitalization
  documentation: fix punctuation
  documentation: use clearer prepositions
  documentation: add missing hyphens
  documentation: remove unnecessary hyphens
  documentation: add missing article
  documentation: fix choice of article
  documentation: whitespace is already generally plural
  documentation: fix singular vs. plural
  documentation: fix verb vs. noun
  documentation: fix adjective vs. noun
  documentation: fix verb tense
  documentation: employ consistent verb tense for a list
  documentation: fix subject/verb agreement
  documentation: remove extraneous words
  ...
</content>
</entry>
<entry>
<title>Merge branch 'tb/repack-max-cruft-size'</title>
<updated>2023-10-18T20:25:41Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2023-10-18T20:25:41Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=79861babe2d58387cd50010c9c63e4ef95afeb12'/>
<id>urn:sha1:79861babe2d58387cd50010c9c63e4ef95afeb12</id>
<content type='text'>
"git repack" learned "--max-cruft-size" to prevent cruft packs from
growing without bounds.

* tb/repack-max-cruft-size:
  repack: free existing_cruft array after use
  builtin/repack.c: avoid making cruft packs preferred
  builtin/repack.c: implement support for `--max-cruft-size`
  builtin/repack.c: parse `--max-pack-size` with OPT_MAGNITUDE
  t7700: split cruft-related tests to t7704
</content>
</entry>
<entry>
<title>doc/git-repack: don't mention nonexistent "--unpacked" option</title>
<updated>2023-10-16T21:21:59Z</updated>
<author>
<name>Patrick Steinhardt</name>
<email>ps@pks.im</email>
</author>
<published>2023-10-16T07:19:56Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=ca3285dd69413c599687e9024127767dd4a3be62'/>
<id>urn:sha1:ca3285dd69413c599687e9024127767dd4a3be62</id>
<content type='text'>
The documentation for geometric repacking mentions a "--unpacked" option
that supposedly changes how loose objects are rolled up. This option has
never existed, and the implied behaviour, namely to include all unpacked
objects into the resulting packfile, is in fact the default behaviour.

Correct the documentation to not mention this option.

Signed-off-by: Patrick Steinhardt &lt;ps@pks.im&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>doc/git-repack: fix syntax for `-g` shorthand option</title>
<updated>2023-10-16T21:21:59Z</updated>
<author>
<name>Patrick Steinhardt</name>
<email>ps@pks.im</email>
</author>
<published>2023-10-16T07:19:51Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=e9cc3a027b0ab97e360748a5a9187fbf22b8a660'/>
<id>urn:sha1:e9cc3a027b0ab97e360748a5a9187fbf22b8a660</id>
<content type='text'>
The `-g` switch is a shorthand for `--geometric=` and allows the user to
specify the geometric. The documentation is wrong though and indicates
that the syntax for the shorthand is `-g=&lt;factor&gt;`. In fact though, the
option must be specified without the equals sign via `-g&lt;factor&gt;`.

Fix the syntax accordingly.

Signed-off-by: Patrick Steinhardt &lt;ps@pks.im&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>documentation: fix singular vs. plural</title>
<updated>2023-10-09T19:06:29Z</updated>
<author>
<name>Elijah Newren</name>
<email>newren@gmail.com</email>
</author>
<published>2023-10-08T06:45:14Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=6cc668c0abd65415a461c6dddfefffaaeb1d5adc'/>
<id>urn:sha1:6cc668c0abd65415a461c6dddfefffaaeb1d5adc</id>
<content type='text'>
Diff best viewed with --color-diff.

Signed-off-by: Elijah Newren &lt;newren@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>documentation: wording improvements</title>
<updated>2023-10-09T19:04:21Z</updated>
<author>
<name>Elijah Newren</name>
<email>newren@gmail.com</email>
</author>
<published>2023-10-08T06:45:03Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=cf6cac20059123d6ec3f867bb3692df62db52cf9'/>
<id>urn:sha1:cf6cac20059123d6ec3f867bb3692df62db52cf9</id>
<content type='text'>
Diff best viewed with --color-diff.

Signed-off-by: Elijah Newren &lt;newren@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>builtin/repack.c: implement support for `--max-cruft-size`</title>
<updated>2023-10-05T20:26:11Z</updated>
<author>
<name>Taylor Blau</name>
<email>me@ttaylorr.com</email>
</author>
<published>2023-10-03T00:44:32Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=37dc6d81042ac41437163264e7a29d3bf50c8d90'/>
<id>urn:sha1:37dc6d81042ac41437163264e7a29d3bf50c8d90</id>
<content type='text'>
Cruft packs are an alternative mechanism for storing a collection of
unreachable objects whose mtimes are recent enough to avoid being
pruned out of the repository.

When cruft packs were first introduced back in b757353676
(builtin/pack-objects.c: --cruft without expiration, 2022-05-20) and
a7d493833f (builtin/pack-objects.c: --cruft with expiration,
2022-05-20), the recommended workflow consisted of:

  - Repacking periodically, either by packing anything loose in the
    repository (via `git repack -d`) or producing a geometric sequence
    of packs (via `git repack --geometric=&lt;d&gt; -d`).

  - Every so often, splitting the repository into two packs, one cruft
    to store the unreachable objects, and another non-cruft pack to
    store the reachable objects.

Repositories may (out of band with the above) choose periodically to
prune out some unreachable objects which have aged out of the grace
period by generating a pack with `--cruft-expiration=&lt;approxidate&gt;`.

This allowed repositories to maintain relatively few packs on average,
and quarantine unreachable objects together in a cruft pack, avoiding
the pitfalls of holding unreachable objects as loose while they age out
(for more, see some of the details in 3d89a8c118
(Documentation/technical: add cruft-packs.txt, 2022-05-20)).

This all works, but can be costly from an I/O-perspective when
frequently repacking a repository that has many unreachable objects.
This problem is exacerbated when those unreachable objects are rarely
(if every) pruned.

Since there is at most one cruft pack in the above scheme, each time we
update the cruft pack it must be rewritten from scratch. Because much of
the pack is reused, this is a relatively inexpensive operation from a
CPU-perspective, but is very costly in terms of I/O since we end up
rewriting basically the same pack (plus any new unreachable objects that
have entered the repository since the last time a cruft pack was
generated).

At the time, we decided against implementing more robust support for
multiple cruft packs. This patch implements that support which we were
lacking.

Introduce a new option `--max-cruft-size` which allows repositories to
accumulate cruft packs up to a given size, after which point a new
generation of cruft packs can accumulate until it reaches the maximum
size, and so on. To generate a new cruft pack, the process works like
so:

  - Sort a list of any existing cruft packs in ascending order of pack
    size.

  - Starting from the beginning of the list, group cruft packs together
    while the accumulated size is smaller than the maximum specified
    pack size.

  - Combine the objects in these cruft packs together into a new cruft
    pack, along with any other unreachable objects which have since
    entered the repository.

Once a cruft pack grows beyond the size specified via `--max-cruft-size`
the pack is effectively frozen. This limits the I/O churn up to a
quadratic function of the value specified by the `--max-cruft-size`
option, instead of behaving quadratically in the number of total
unreachable objects.

When pruning unreachable objects, we bypass the new code paths which
combine small cruft packs together, and instead start from scratch,
passing in the appropriate `--max-pack-size` down to `pack-objects`,
putting it in charge of keeping the resulting set of cruft packs sized
correctly.

This may seem like further I/O churn, but in practice it isn't so bad.
We could prune old cruft packs for whom all or most objects are removed,
and then generate a new cruft pack with just the remaining set of
objects. But this additional complexity buys us relatively little,
because most objects end up being pruned anyway, so the I/O churn is
well contained.

Signed-off-by: Taylor Blau &lt;me@ttaylorr.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>repack: implement `--filter-to` for storing filtered out objects</title>
<updated>2023-10-02T21:54:31Z</updated>
<author>
<name>Christian Couder</name>
<email>christian.couder@gmail.com</email>
</author>
<published>2023-10-02T16:55:03Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=71c5aec1f54eba5a2856f72d85823af64e5deb34'/>
<id>urn:sha1:71c5aec1f54eba5a2856f72d85823af64e5deb34</id>
<content type='text'>
A previous commit has implemented `git repack --filter=&lt;filter-spec&gt;` to
allow users to filter out some objects from the main pack and move them
into a new different pack.

It would be nice if this new different pack could be created in a
different directory than the regular pack. This would make it possible
to move large blobs into a pack on a different kind of storage, for
example cheaper storage.

Even in a different directory, this pack can be accessible if, for
example, the Git alternates mechanism is used to point to it. In fact
not using the Git alternates mechanism can corrupt a repo as the
generated pack containing the filtered objects might not be accessible
from the repo any more. So setting up the Git alternates mechanism
should be done before using this feature if the user wants the repo to
be fully usable while this feature is used.

In some cases, like when a repo has just been cloned or when there is no
other activity in the repo, it's Ok to setup the Git alternates
mechanism afterwards though. It's also Ok to just inspect the generated
packfile containing the filtered objects and then just move it into the
'.git/objects/pack/' directory manually. That's why it's not necessary
for this command to check that the Git alternates mechanism has been
already setup.

While at it, as an example to show that `--filter` and `--filter-to`
work well with other options, let's also add a test to check that these
options work well with `--max-pack-size`.

Signed-off-by: Christian Couder &lt;chriscool@tuxfamily.org&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>repack: add `--filter=&lt;filter-spec&gt;` option</title>
<updated>2023-10-02T21:54:30Z</updated>
<author>
<name>Christian Couder</name>
<email>christian.couder@gmail.com</email>
</author>
<published>2023-10-02T16:55:01Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=48a9b67b4301083d0820e90afef208ed1436298f'/>
<id>urn:sha1:48a9b67b4301083d0820e90afef208ed1436298f</id>
<content type='text'>
This new option puts the objects specified by `&lt;filter-spec&gt;` into a
separate packfile.

This could be useful if, for example, some blobs take up a lot of
precious space on fast storage while they are rarely accessed. It could
make sense to move them into a separate cheaper, though slower, storage.

It's possible to find which new packfile contains the filtered out
objects using one of the following:

  - `git verify-pack -v ...`,
  - `test-tool find-pack ...`, which a previous commit added,
  - `--filter-to=&lt;dir&gt;`, which a following commit will add to specify
    where the pack containing the filtered out objects will be.

This feature is implemented by running `git pack-objects` twice in a
row. The first command is run with `--filter=&lt;filter-spec&gt;`, using the
specified filter. It packs objects while omitting the objects specified
by the filter. Then another `git pack-objects` command is launched using
`--stdin-packs`. We pass it all the previously existing packs into its
stdin, so that it will pack all the objects in the previously existing
packs. But we also pass into its stdin, the pack created by the previous
`git pack-objects --filter=&lt;filter-spec&gt;` command as well as the kept
packs, all prefixed with '^', so that the objects in these packs will be
omitted from the resulting pack. The result is that only the objects
filtered out by the first `git pack-objects` command are in the pack
resulting from the second `git pack-objects` command.

As the interactions with kept packs are a bit tricky, a few related
tests are added.

Helped-by: Taylor Blau &lt;me@ttaylorr.com&gt;
Signed-off-by: John Cai &lt;johncai86@gmail.com&gt;
Signed-off-by: Christian Couder &lt;chriscool@tuxfamily.org&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
</feed>
