<feed xmlns='http://www.w3.org/2005/Atom'>
<title>git/pack-write.c, branch v1.9.2</title>
<subtitle>Mirror of https://git.kernel.org/pub/scm/git/git.git/
</subtitle>
<id>https://www.git.shady.money/git/atom?h=v1.9.2</id>
<link rel='self' href='https://www.git.shady.money/git/atom?h=v1.9.2'/>
<link rel='alternate' type='text/html' href='https://www.git.shady.money/git/'/>
<updated>2014-01-10T18:33:09Z</updated>
<entry>
<title>Merge branch 'jk/sha1write-void'</title>
<updated>2014-01-10T18:33:09Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2014-01-10T18:33:09Z</published>
<link rel='alternate' type='text/html' href='https://www.git.shady.money/git/commit/?id=f06a5e607dde266884db4a99b70fbee09d5c5efc'/>
<id>urn:sha1:f06a5e607dde266884db4a99b70fbee09d5c5efc</id>
<content type='text'>
Code clean-up.

* jk/sha1write-void:
  do not pretend sha1write returns errors
</content>
</entry>
<entry>
<title>do not pretend sha1write returns errors</title>
<updated>2013-12-26T19:50:20Z</updated>
<author>
<name>Jeff King</name>
<email>peff@peff.net</email>
</author>
<published>2013-12-21T14:13:25Z</published>
<link rel='alternate' type='text/html' href='https://www.git.shady.money/git/commit/?id=9af270e8c2a02afd9a3262a2c9312ee7fefbb7a3'/>
<id>urn:sha1:9af270e8c2a02afd9a3262a2c9312ee7fefbb7a3</id>
<content type='text'>
The sha1write function returns an int, but it will always be
"0". The failure-prone parts of the function happen in the
"flush" callback, which cannot pass an error back to us. So
we just end up calling die() during the flush.

Let's just drop the return value altogether, as it only
confuses callers into thinking that it might be useful.

Only one call site actually checked the return value. We can
drop that check, since it just led to a die() anyway.

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>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://www.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>Appease Sun Studio by renaming "tmpfile"</title>
<updated>2011-12-21T18:21:04Z</updated>
<author>
<name>Ævar Arnfjörð Bjarmason</name>
<email>avarab@gmail.com</email>
</author>
<published>2011-12-21T01:18:21Z</published>
<link rel='alternate' type='text/html' href='https://www.git.shady.money/git/commit/?id=ab1900a36ef7fcfe872ff9d0803f9442e356c2f0'/>
<id>urn:sha1:ab1900a36ef7fcfe872ff9d0803f9442e356c2f0</id>
<content type='text'>
On Solaris the system headers define the "tmpfile" name, which'll
cause Git compiled with Sun Studio 12 Update 1 to whine about us
redefining the name:

    "pack-write.c", line 76: warning: name redefined by pragma redefine_extname declared static: tmpfile     (E_PRAGMA_REDEFINE_STATIC)
    "sha1_file.c", line 2455: warning: name redefined by pragma redefine_extname declared static: tmpfile    (E_PRAGMA_REDEFINE_STATIC)
    "fast-import.c", line 858: warning: name redefined by pragma redefine_extname declared static: tmpfile   (E_PRAGMA_REDEFINE_STATIC)
    "builtin/index-pack.c", line 175: warning: name redefined by pragma redefine_extname declared static: tmpfile    (E_PRAGMA_REDEFINE_STATIC)

Just renaming the "tmpfile" variable to "tmp_file" in the relevant
places is the easiest way to fix this.

Signed-off-by: Ævar Arnfjörð Bjarmason &lt;avarab@gmail.com&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://www.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>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://www.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>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://www.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://www.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://www.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>
<entry>
<title>index-pack --verify: read anomalous offsets from v2 idx file</title>
<updated>2011-02-28T07:29:03Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2011-02-26T00:55:26Z</published>
<link rel='alternate' type='text/html' href='https://www.git.shady.money/git/commit/?id=3c9fc074c220d5d1d2173c84cc6ae57d750e2a2c'/>
<id>urn:sha1:3c9fc074c220d5d1d2173c84cc6ae57d750e2a2c</id>
<content type='text'>
A pack v2 .idx file usually records offset using 64-bit representation
only when the offset does not fit within 31-bit, but you can handcraft
your .idx file to record smaller offset using 64-bit, storing all zero
in the upper 4-byte.  By inspecting the original idx file when running
index-pack --verify, encode such low offsets that do not need to be in
64-bit but are encoded using 64-bit just like the original idx file so
that we can still validate the pack/idx pair by comparing the idx file
recomputed with the original.

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