<feed xmlns='http://www.w3.org/2005/Atom'>
<title>git/builtin/pack-objects.c, branch v2.15.2</title>
<subtitle>Mirror of https://git.kernel.org/pub/scm/git/git.git/
</subtitle>
<id>https://git.shady.money/git/atom?h=v2.15.2</id>
<link rel='self' href='https://git.shady.money/git/atom?h=v2.15.2'/>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/'/>
<updated>2017-10-09T23:57:24Z</updated>
<entry>
<title>cleanup: fix possible overflow errors in binary search</title>
<updated>2017-10-09T23:57:24Z</updated>
<author>
<name>Derrick Stolee</name>
<email>dstolee@microsoft.com</email>
</author>
<published>2017-10-08T18:29:37Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=19716b21a4255ecc7148b54ab2c78039c59f25bf'/>
<id>urn:sha1:19716b21a4255ecc7148b54ab2c78039c59f25bf</id>
<content type='text'>
A common mistake when writing binary search is to allow possible
integer overflow by using the simple average:

	mid = (min + max) / 2;

Instead, use the overflow-safe version:

	mid = min + (max - min) / 2;

This translation is safe since the operation occurs inside a loop
conditioned on "min &lt; max". The included changes were found using
the following git grep:

	git grep '/ *2;' '*.c'

Making this cleanup will prevent future review friction when a new
binary search is contructed based on existing code.

Signed-off-by: Derrick Stolee &lt;dstolee@microsoft.com&gt;
Reviewed-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 'rj/no-sign-compare'</title>
<updated>2017-09-29T02:23:42Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2017-09-29T02:23:42Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=14a8168e2fed3934f1f9afb286f1c64345d06790'/>
<id>urn:sha1:14a8168e2fed3934f1f9afb286f1c64345d06790</id>
<content type='text'>
Many codepaths have been updated to squelch -Wsign-compare
warnings.

* rj/no-sign-compare:
  ALLOC_GROW: avoid -Wsign-compare warnings
  cache.h: hex2chr() - avoid -Wsign-compare warnings
  commit-slab.h: avoid -Wsign-compare warnings
  git-compat-util.h: xsize_t() - avoid -Wsign-compare warnings
</content>
</entry>
<entry>
<title>ALLOC_GROW: avoid -Wsign-compare warnings</title>
<updated>2017-09-22T04:21:11Z</updated>
<author>
<name>Ramsay Jones</name>
<email>ramsay@ramsayjones.plus.com</email>
</author>
<published>2017-09-21T16:49:38Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=071bcaab6480dea80a47f574f61dc2cd9518e7dc'/>
<id>urn:sha1:071bcaab6480dea80a47f574f61dc2cd9518e7dc</id>
<content type='text'>
Signed-off-by: Ramsay Jones &lt;ramsay@ramsayjones.plus.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>pack: make packed_git_mru global a value instead of a pointer</title>
<updated>2017-09-14T06:05:48Z</updated>
<author>
<name>Jonathan Nieder</name>
<email>jrnieder@gmail.com</email>
</author>
<published>2017-09-12T17:28:39Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=607bd8315c6886eb61561bbba394616bc6fdf031'/>
<id>urn:sha1:607bd8315c6886eb61561bbba394616bc6fdf031</id>
<content type='text'>
The MRU cache that keeps track of recently used packs is represented
using two global variables:

	struct mru packed_git_mru_storage;
	struct mru *packed_git_mru = &amp;packed_git_mru_storage;

Callers never assign to the packed_git_mru pointer, though, so we can
simplify by eliminating it and using &amp;packed_git_mru_storage (renamed
to &amp;packed_git_mru) directly.  This variable is only used by the
packfile subsystem, making this a relatively uninvasive change (and
any new unadapted callers would trigger a compile error).

Noticed while moving these globals to the object_store struct.

Signed-off-by: Stefan Beller &lt;sbeller@google.com&gt;
Signed-off-by: Jonathan Nieder &lt;jrnieder@gmail.com&gt;
Acked-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 'ma/ts-cleanups'</title>
<updated>2017-09-10T08:08:22Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2017-09-10T08:08:22Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=a48ce378585054f2ae3b2f0e18346ab005290524'/>
<id>urn:sha1:a48ce378585054f2ae3b2f0e18346ab005290524</id>
<content type='text'>
Assorted bugfixes and clean-ups.

* ma/ts-cleanups:
  ThreadSanitizer: add suppressions
  strbuf_setlen: don't write to strbuf_slopbuf
  pack-objects: take lock before accessing `remaining`
  convert: always initialize attr_action in convert_attrs
</content>
</entry>
<entry>
<title>pack: move open_pack_index(), parse_pack_index()</title>
<updated>2017-08-23T22:12:06Z</updated>
<author>
<name>Jonathan Tan</name>
<email>jonathantanmy@google.com</email>
</author>
<published>2017-08-18T22:20:19Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=0317f45576a0b48c90c4b023fa572a000633946c'/>
<id>urn:sha1:0317f45576a0b48c90c4b023fa572a000633946c</id>
<content type='text'>
alloc_packed_git() in packfile.c is duplicated from sha1_file.c. In a
subsequent commit, alloc_packed_git() will be removed from sha1_file.c.

Signed-off-by: Jonathan Tan &lt;jonathantanmy@google.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>Merge branch 'rs/pack-objects-pbase-cleanup' into maint</title>
<updated>2017-08-23T21:33:48Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2017-08-23T21:33:48Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=e22a48c4c093b7af1393c6509e3ad39c3bab8473'/>
<id>urn:sha1:e22a48c4c093b7af1393c6509e3ad39c3bab8473</id>
<content type='text'>
Code clean-up.

* rs/pack-objects-pbase-cleanup:
  pack-objects: remove unnecessary NULL check
</content>
</entry>
<entry>
<title>pack-objects: take lock before accessing `remaining`</title>
<updated>2017-08-23T17:14:19Z</updated>
<author>
<name>Martin Ågren</name>
<email>martin.agren@gmail.com</email>
</author>
<published>2017-08-21T17:43:46Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=0c2ad00b3c5a822224265c2551844b2eafc89875'/>
<id>urn:sha1:0c2ad00b3c5a822224265c2551844b2eafc89875</id>
<content type='text'>
When checking the conditional of "while (me-&gt;remaining)", we did not
hold the lock. Calling find_deltas would still be safe, since it checks
"remaining" (after taking the lock) and is able to handle all values. In
fact, this could (currently) not trigger any bug: a bug could happen if
`remaining` transitioning from zero to non-zero races with the evaluation
of the while-condition, but these are always separated by the
data_ready-mechanism.

Make sure we have the lock when we read `remaining`. This does mean we
release it just so that find_deltas can take it immediately again. We
could tweak the contract so that the lock should be taken before calling
find_deltas, but let's defer that until someone can actually show that
"unlock+lock" has a measurable negative impact.

Signed-off-by: Martin Ågren &lt;martin.agren@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>Merge branch 'rs/pack-objects-pbase-cleanup'</title>
<updated>2017-08-11T20:27:00Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2017-08-11T20:27:00Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=e57856502d93d1571d1280638b5b33000412d109'/>
<id>urn:sha1:e57856502d93d1571d1280638b5b33000412d109</id>
<content type='text'>
Code clean-up.

* rs/pack-objects-pbase-cleanup:
  pack-objects: remove unnecessary NULL check
</content>
</entry>
<entry>
<title>pack-objects: remove unnecessary NULL check</title>
<updated>2017-07-20T21:50:20Z</updated>
<author>
<name>René Scharfe</name>
<email>l.s.r@web.de</email>
</author>
<published>2017-07-20T20:32:56Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=c7b078054523a1a16ec49d9071877475c4ca5482'/>
<id>urn:sha1:c7b078054523a1a16ec49d9071877475c4ca5482</id>
<content type='text'>
If done_pbase_paths is NULL then done_pbase_paths_num must be zero and
done_pbase_path_pos() returns -1 without accessing the array, so the
check is not necessary.

If the invariant was violated then the check would make sure we keep
on going and allocate the necessary amount of memory in the next
ALLOC_GROW call.  That sounds nice, but all array entries except for
one would contain garbage data.

If the invariant was violated without the check we'd get a segfault in
done_pbase_path_pos(), i.e. an observable crash, alerting us of the
presence of a bug.

Currently there is no such bug: Only the functions check_pbase_path()
and cleanup_preferred_base() change pointer and counter, and both make
sure to keep them in sync.  Get rid of the check anyway to allow us to
see if later changes introduce such a defect, and to simplify the code.

Detected by Coverity Scan.

Signed-off-by: Rene Scharfe &lt;l.s.r@web.de&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
</feed>
