<feed xmlns='http://www.w3.org/2005/Atom'>
<title>git/refs, branch v2.17.2</title>
<subtitle>Mirror of https://git.kernel.org/pub/scm/git/git.git/
</subtitle>
<id>https://git.shady.money/git/atom?h=v2.17.2</id>
<link rel='self' href='https://git.shady.money/git/atom?h=v2.17.2'/>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/'/>
<updated>2018-02-15T22:55:42Z</updated>
<entry>
<title>Merge branch 'kg/packed-ref-cache-fix'</title>
<updated>2018-02-15T22:55:42Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2018-02-15T22:55:42Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=9db22910f74b64764d4fb4e17f8aef4eb5aa6af0'/>
<id>urn:sha1:9db22910f74b64764d4fb4e17f8aef4eb5aa6af0</id>
<content type='text'>
Avoid mmapping small files while using packed refs (especially ones
with zero size, which would cause later munmap() to fail).

* kg/packed-ref-cache-fix:
  packed_ref_cache: don't use mmap() for small files
  load_contents(): don't try to mmap an empty file
  packed_ref_iterator_begin(): make optimization more general
  find_reference_location(): make function safe for empty snapshots
  create_snapshot(): use `xmemdupz()` rather than a strbuf
  struct snapshot: store `start` rather than `header_len`
</content>
</entry>
<entry>
<title>Merge branch 'sg/cocci-move-array'</title>
<updated>2018-02-13T21:39:13Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2018-02-13T21:39:13Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=cbf0240f82fc6b7072c7d18fa56caace4902a44b'/>
<id>urn:sha1:cbf0240f82fc6b7072c7d18fa56caace4902a44b</id>
<content type='text'>
Code clean-up.

* sg/cocci-move-array:
  Use MOVE_ARRAY
</content>
</entry>
<entry>
<title>Merge branch 'mr/packed-ref-store-fix'</title>
<updated>2018-02-13T21:39:11Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2018-02-13T21:39:11Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=2b72ea0a48e8e5711f9bba122cbaf2bbe10737bc'/>
<id>urn:sha1:2b72ea0a48e8e5711f9bba122cbaf2bbe10737bc</id>
<content type='text'>
Crash fix for a corner case where an error codepath tried to unlock
what it did not acquire lock on.

* mr/packed-ref-store-fix:
  files_initial_transaction_commit(): only unlock if locked
</content>
</entry>
<entry>
<title>packed_ref_cache: don't use mmap() for small files</title>
<updated>2018-01-24T20:55:26Z</updated>
<author>
<name>Kim Gybels</name>
<email>kgybels@infogroep.be</email>
</author>
<published>2018-01-24T11:14:16Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=ba41a8b600871b68680ff33de08012f4887133a2'/>
<id>urn:sha1:ba41a8b600871b68680ff33de08012f4887133a2</id>
<content type='text'>
Take a hint from commit ea68b0ce9f8 (hash-object: don't use mmap() for
small files, 2010-02-21) and use read() instead of mmap() for small
packed-refs files.

Signed-off-by: Kim Gybels &lt;kgybels@infogroep.be&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
Signed-off-by: Michael Haggerty &lt;mhagger@alum.mit.edu&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>load_contents(): don't try to mmap an empty file</title>
<updated>2018-01-24T20:55:26Z</updated>
<author>
<name>Michael Haggerty</name>
<email>mhagger@alum.mit.edu</email>
</author>
<published>2018-01-24T11:14:15Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=01caf20d57aea73e67337ba1d396dd80a76d9dc3'/>
<id>urn:sha1:01caf20d57aea73e67337ba1d396dd80a76d9dc3</id>
<content type='text'>
We don't actually create zero-length `packed-refs` files, but they are
valid and we should handle them correctly. The old code `xmmap()`ed
such files, which led to an error when `munmap()` was called. So, if
the `packed-refs` file is empty, leave the snapshot at its zero values
and return 0 without trying to read or mmap the file.

Returning 0 also makes `create_snapshot()` exit early, which avoids
the technically undefined comparison `NULL &lt; NULL`.

Reported-by: Kim Gybels &lt;kgybels@infogroep.be&gt;
Signed-off-by: Michael Haggerty &lt;mhagger@alum.mit.edu&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>packed_ref_iterator_begin(): make optimization more general</title>
<updated>2018-01-24T20:55:26Z</updated>
<author>
<name>Michael Haggerty</name>
<email>mhagger@alum.mit.edu</email>
</author>
<published>2018-01-24T11:14:14Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=f34242975fae1468dd94d31289d27f68853a28fb'/>
<id>urn:sha1:f34242975fae1468dd94d31289d27f68853a28fb</id>
<content type='text'>
We can return an empty iterator not only if the `packed-refs` file is
missing, but also if it is empty or if there are no references whose
names succeed `prefix`. Optimize away those cases as well by moving
the call to `find_reference_location()` higher in the function and
checking whether the determined start position is the same as
`snapshot-&gt;eof`. (This is possible now because the previous commit
made `find_reference_location()` robust against empty snapshots.)

Signed-off-by: Michael Haggerty &lt;mhagger@alum.mit.edu&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>find_reference_location(): make function safe for empty snapshots</title>
<updated>2018-01-24T20:55:26Z</updated>
<author>
<name>Michael Haggerty</name>
<email>mhagger@alum.mit.edu</email>
</author>
<published>2018-01-24T11:14:13Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=4a14f8d093138a313070fd6a50204eda66c1f9eb'/>
<id>urn:sha1:4a14f8d093138a313070fd6a50204eda66c1f9eb</id>
<content type='text'>
This function had two problems if called for an empty snapshot (i.e.,
`snapshot-&gt;start == snapshot-&gt;eof == NULL`):

* It checked `NULL &lt; NULL`, which is undefined by C (albeit highly
  unlikely to fail in the real world).

* (Assuming the above comparison behaved as expected), it returned
  NULL when `mustexist` was false, contrary to its docstring.

Change the check and fix the docstring.

Signed-off-by: Michael Haggerty &lt;mhagger@alum.mit.edu&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>create_snapshot(): use `xmemdupz()` rather than a strbuf</title>
<updated>2018-01-24T20:55:26Z</updated>
<author>
<name>Michael Haggerty</name>
<email>mhagger@alum.mit.edu</email>
</author>
<published>2018-01-24T11:14:12Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=27a41841ec7f83b3b1078c400f149bc536e796a4'/>
<id>urn:sha1:27a41841ec7f83b3b1078c400f149bc536e796a4</id>
<content type='text'>
It's lighter weight.

Signed-off-by: Michael Haggerty &lt;mhagger@alum.mit.edu&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>struct snapshot: store `start` rather than `header_len`</title>
<updated>2018-01-24T20:55:26Z</updated>
<author>
<name>Michael Haggerty</name>
<email>mhagger@alum.mit.edu</email>
</author>
<published>2018-01-24T11:14:11Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=4a2854f77cc913fafc7f3191a61b343280979643'/>
<id>urn:sha1:4a2854f77cc913fafc7f3191a61b343280979643</id>
<content type='text'>
Store a pointer to the start of the actual references within the
`packed-refs` contents rather than storing the length of the header.
This is more convenient for most users of this field.

Signed-off-by: Michael Haggerty &lt;mhagger@alum.mit.edu&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>Use MOVE_ARRAY</title>
<updated>2018-01-22T19:32:51Z</updated>
<author>
<name>SZEDER Gábor</name>
<email>szeder.dev@gmail.com</email>
</author>
<published>2018-01-22T17:50:09Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=f919ffebed3c570bf3c2a5f36444527ea5df42de'/>
<id>urn:sha1:f919ffebed3c570bf3c2a5f36444527ea5df42de</id>
<content type='text'>
Use the helper macro MOVE_ARRAY to move arrays.  This is shorter and
safer, as it automatically infers the size of elements.

Patch generated by Coccinelle and contrib/coccinelle/array.cocci in
Travis CI's static analysis build job.

Signed-off-by: SZEDER Gábor &lt;szeder.dev@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
</feed>
