<feed xmlns='http://www.w3.org/2005/Atom'>
<title>git/pack.h, branch v2.6.2</title>
<subtitle>Mirror of https://git.kernel.org/pub/scm/git/git.git/
</subtitle>
<id>https://git.shady.money/git/atom?h=v2.6.2</id>
<link rel='self' href='https://git.shady.money/git/atom?h=v2.6.2'/>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/'/>
<updated>2014-03-03T20:15:10Z</updated>
<entry>
<title>finish_tmp_packfile():use strbuf for pathname construction</title>
<updated>2014-03-03T20:15:10Z</updated>
<author>
<name>Sun He</name>
<email>sunheehnus@gmail.com</email>
</author>
<published>2014-03-03T09:24:29Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=5889271114a25b6750bb6137784ae5a93df22b39'/>
<id>urn:sha1:5889271114a25b6750bb6137784ae5a93df22b39</id>
<content type='text'>
The old version fixes a maximum length on the buffer, which could be a problem
if one is not certain of the length of get_object_directory().
Using strbuf can avoid the protential bug.

Helped-by: Michael Haggerty &lt;mhagger@alum.mit.edu&gt;
Helped-by: Eric Sunshine &lt;sunshine@sunshineco.com&gt;
Signed-off-by: Sun He &lt;sunheehnus@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>pack-objects: name pack files after trailer hash</title>
<updated>2013-12-05T23:40:11Z</updated>
<author>
<name>Jeff King</name>
<email>peff@peff.net</email>
</author>
<published>2013-12-05T20:28:07Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=1190a1acf800acdcfd7569f87ac1560e2d077414'/>
<id>urn:sha1:1190a1acf800acdcfd7569f87ac1560e2d077414</id>
<content type='text'>
Our current scheme for naming packfiles is to calculate the
sha1 hash of the sorted list of objects contained in the
packfile. This gives us a unique name, so we are reasonably
sure that two packs with the same name will contain the same
objects.

It does not, however, tell us that two such packs have the
exact same bytes. This makes things awkward if we repack the
same set of objects. Due to run-to-run variations, the bytes
may not be identical (e.g., changed zlib or git versions,
different source object reuse due to new packs in the
repository, or even different deltas due to races during a
multi-threaded delta search).

In theory, this could be helpful to a program that cares
that the packfile contains a certain set of objects, but
does not care about the particular representation. In
practice, no part of git makes use of that, and in many
cases it is potentially harmful. For example, if a dumb http
client fetches the .idx file, it must be sure to get the
exact .pack that matches it. Similarly, a partial transfer
of a .pack file cannot be safely resumed, as the actual
bytes may have changed.  This could also affect a local
client which opened the .idx and .pack files, closes the
.pack file (due to memory or file descriptor limits), and
then re-opens a changed packfile.

In all of these cases, git can detect the problem, as we
have the sha1 of the bytes themselves in the pack trailer
(which we verify on transfer), and the .idx file references
the trailer from the matching packfile. But it would be
simpler and more efficient to actually get the correct
bytes, rather than noticing the problem and having to
restart the operation.

This patch simply uses the pack trailer sha1 as the pack
name. It should be similarly unique, but covers the exact
representation of the objects. Other parts of git should not
care, as the pack name is returned by pack-objects and is
essentially opaque.

One test needs to be updated, because it actually corrupts a
pack and expects that re-packing the corrupted bytes will
use the same name. It won't anymore, but we can easily just
use the name that pack-objects hands back.

Signed-off-by: Jeff King &lt;peff@peff.net&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>Merge branch 'jc/stream-to-pack'</title>
<updated>2011-12-17T06:33:40Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2011-12-17T06:33:40Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=48b303675aa238c209e527feadcbb7ba1c025c97'/>
<id>urn:sha1:48b303675aa238c209e527feadcbb7ba1c025c97</id>
<content type='text'>
* jc/stream-to-pack:
  bulk-checkin: replace fast-import based implementation
  csum-file: introduce sha1file_checkpoint
  finish_tmp_packfile(): a helper function
  create_tmp_packfile(): a helper function
  write_pack_header(): a helper function

Conflicts:
	pack.h
</content>
</entry>
<entry>
<title>Merge branch 'jc/index-pack-reject-dups'</title>
<updated>2011-12-05T23:13:42Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2011-12-05T23:13:42Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=33fba9c64e305c64b4d6f4c31f02c1dd7e8fbfa8'/>
<id>urn:sha1:33fba9c64e305c64b4d6f4c31f02c1dd7e8fbfa8</id>
<content type='text'>
* jc/index-pack-reject-dups:
  receive-pack, fetch-pack: reject bogus pack that records objects twice
</content>
</entry>
<entry>
<title>receive-pack, fetch-pack: reject bogus pack that records objects twice</title>
<updated>2011-11-17T06:05:21Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2011-11-17T06:04:13Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=68be2fea50e7a34c0e5f9fdf6adb9040c8df197f'/>
<id>urn:sha1:68be2fea50e7a34c0e5f9fdf6adb9040c8df197f</id>
<content type='text'>
When receive-pack &amp; fetch-pack are run and store the pack obtained over
the wire to a local repository, they internally run the index-pack command
with the --strict option. Make sure that we reject incoming packfile that
records objects twice to avoid spreading such a damage.

Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>fsck: print progress</title>
<updated>2011-11-07T04:31:28Z</updated>
<author>
<name>Nguyễn Thái Ngọc Duy</name>
<email>pclouds@gmail.com</email>
</author>
<published>2011-11-07T02:59:26Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=1e49f22f07881dffc04f8f09d4ad4e4a65b85b09'/>
<id>urn:sha1:1e49f22f07881dffc04f8f09d4ad4e4a65b85b09</id>
<content type='text'>
fsck is usually a long process and it would be nice if it prints
progress from time to time.

Progress meter is not printed when --verbose is given because
--verbose prints a lot, there's no need for "alive" indicator.
Progress meter may provide "% complete" information but it would
be lost anyway in the flood of text.

Signed-off-by: Nguyễn Thái Ngọc Duy &lt;pclouds@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>fsck: avoid reading every object twice</title>
<updated>2011-11-07T04:31:28Z</updated>
<author>
<name>Nguyễn Thái Ngọc Duy</name>
<email>pclouds@gmail.com</email>
</author>
<published>2011-11-07T02:59:25Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=c9486eb04dd99fc00df3e68f9b908f9ad7ff9728'/>
<id>urn:sha1:c9486eb04dd99fc00df3e68f9b908f9ad7ff9728</id>
<content type='text'>
During verify_pack() all objects are read for SHA-1 check. Then
fsck_sha1() is called on every object, which read the object again
(fsck_sha1 -&gt; parse_object -&gt; read_sha1_file).

Avoid reading an object twice, do fsck_sha1 while we have an object
uncompressed data in verify_pack.

On git.git, with this patch I got:

$ /usr/bin/time ./git fsck &gt;/dev/null
98.97user 0.90system 1:40.01elapsed 99%CPU (0avgtext+0avgdata 616624maxresident)k
0inputs+0outputs (0major+194186minor)pagefaults 0swaps

Without it:

$ /usr/bin/time ./git fsck &gt;/dev/null
231.23user 2.35system 3:53.82elapsed 99%CPU (0avgtext+0avgdata 636688maxresident)k
0inputs+0outputs (0major+461629minor)pagefaults 0swaps

Signed-off-by: Nguyễn Thái Ngọc Duy &lt;pclouds@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>finish_tmp_packfile(): a helper function</title>
<updated>2011-10-28T19:34:09Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2011-10-28T19:34:09Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=0e990530ae6d6c6805d31c666953541f762dd402'/>
<id>urn:sha1:0e990530ae6d6c6805d31c666953541f762dd402</id>
<content type='text'>
Factor out a small logic out of the private write_pack_file() function
in builtin/pack-objects.c.

This changes the order of finishing multi-pack generation slightly. The
code used to

 - adjust shared perm of temporary packfile
 - rename temporary packfile to the final name
 - update mtime of the packfile under the final name
 - adjust shared perm of temporary idxfile
 - rename temporary idxfile to the final name

but because the helper does not want to do the mtime thing, the updated
code does that step first and then all the rest.

Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>create_tmp_packfile(): a helper function</title>
<updated>2011-10-28T18:52:14Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2011-10-28T18:52:14Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=cdf9db3c83618453809d6a584d1a0db19b3e189f'/>
<id>urn:sha1:cdf9db3c83618453809d6a584d1a0db19b3e189f</id>
<content type='text'>
Factor out a small logic out of the private write_pack_file() function
in builtin/pack-objects.c

Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>write_pack_header(): a helper function</title>
<updated>2011-10-28T18:40:48Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2011-10-28T18:40:48Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=c0ad465725302b9411e53d248871c36880b6f8fd'/>
<id>urn:sha1:c0ad465725302b9411e53d248871c36880b6f8fd</id>
<content type='text'>
Factor out a small logic out of the private write_pack_file() function
in builtin/pack-objects.c

Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
</feed>
