<feed xmlns='http://www.w3.org/2005/Atom'>
<title>git/refs.c, branch v2.10.2</title>
<subtitle>Mirror of https://git.kernel.org/pub/scm/git/git.git/
</subtitle>
<id>https://git.shady.money/git/atom?h=v2.10.2</id>
<link rel='self' href='https://git.shady.money/git/atom?h=v2.10.2'/>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/'/>
<updated>2016-10-12T18:22:10Z</updated>
<entry>
<title>cocci: refactor common patterns to use xstrdup_or_null()</title>
<updated>2016-10-12T18:22:10Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2016-10-12T18:20:23Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=13092a916d7b8211fd828a6a7ee0d3cefff995e1'/>
<id>urn:sha1:13092a916d7b8211fd828a6a7ee0d3cefff995e1</id>
<content type='text'>
d64ea0f83b ("git-compat-util: add xstrdup_or_null helper",
2015-01-12) added a handy wrapper that allows us to get a duplicate
of a string or NULL if the original is NULL, but a handful of
codepath predate its introduction or just weren't aware of it.

Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>pass constants as first argument to st_mult()</title>
<updated>2016-08-01T21:01:03Z</updated>
<author>
<name>René Scharfe</name>
<email>l.s.r@web.de</email>
</author>
<published>2016-07-30T18:18:31Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=50492f7b38f84619cbfb443efc3c0c78fc0304dd'/>
<id>urn:sha1:50492f7b38f84619cbfb443efc3c0c78fc0304dd</id>
<content type='text'>
The result of st_mult() is the same no matter the order of its
arguments.  It invokes the macro unsigned_mult_overflows(), which
divides the second parameter by the first one.  Pass constants
first to allow that division to be done already at compile time.

Signed-off-by: Rene Scharfe &lt;l.s.r@web.de&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>do_for_each_ref(): reimplement using reference iteration</title>
<updated>2016-06-20T18:38:20Z</updated>
<author>
<name>Michael Haggerty</name>
<email>mhagger@alum.mit.edu</email>
</author>
<published>2016-06-18T04:15:16Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=4c4de89573fa29b7f97e7a9a3d0674dbdb6f2a28'/>
<id>urn:sha1:4c4de89573fa29b7f97e7a9a3d0674dbdb6f2a28</id>
<content type='text'>
Use the reference iterator interface to implement do_for_each_ref().
Delete a bunch of code supporting the old for_each_ref() implementation.
And now that do_for_each_ref() is generic code (it is no longer tied to
the files backend), move it to refs.c.

The implementation is via a new function, do_for_each_ref_iterator(),
which takes a reference iterator as argument and calls a callback
function for each of the references in the iterator.

This change requires the current_ref performance hack for peel_ref() to
be implemented via ref_iterator_peel() rather than peel_entry() because
we don't have a ref_entry handy (it is hidden under three layers:
file_ref_iterator, merge_ref_iterator, and cache_ref_iterator). So:

* do_for_each_ref_iterator() records the active iterator in
  current_ref_iter while it is running.

* peel_ref() checks whether current_ref_iter is pointing at the
  requested reference. If so, it asks the iterator to peel the
  reference (which it can do efficiently via its "peel" virtual
  function). For extra safety, we do the optimization only if the
  refname *addresses* are the same, not only if the refname *strings*
  are the same, to forestall possible mixups between refnames that come
  from different ref_iterators.

Please note that this optimization of peel_ref() is only available when
iterating via do_for_each_ref_iterator() (including all of the
for_each_ref() functions, which call it indirectly). It would be
complicated to implement a similar optimization when iterating directly
using a reference iterator, because multiple reference iterators can be
in use at the same time, with interleaved calls to
ref_iterator_advance(). (In fact we do exactly that in
merge_ref_iterator.)

But that is not necessary. peel_ref() is only called while iterating
over references. Callers who iterate using the for_each_ref() functions
benefit from the optimization described above. Callers who iterate using
reference iterators directly have access to the ref_iterator, so they
can call ref_iterator_peel() themselves to get an analogous optimization
in a more straightforward manner.

If we rewrite all callers to use the reference iteration API, then we
can remove the current_ref_iter hack permanently.

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>ref_transaction_update(): check refname_is_safe() at a minimum</title>
<updated>2016-06-13T09:23:50Z</updated>
<author>
<name>Michael Haggerty</name>
<email>mhagger@alum.mit.edu</email>
</author>
<published>2016-04-27T13:54:45Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=8a679de6f1a4bd077f828273f75eea46947b5b73'/>
<id>urn:sha1:8a679de6f1a4bd077f828273f75eea46947b5b73</id>
<content type='text'>
If the user has asked that a new value be set for a reference, we use
check_refname_format() to verify that the reference name satisfies all
of the rules. But in other cases, at least check that refname_is_safe().

Signed-off-by: Michael Haggerty &lt;mhagger@alum.mit.edu&gt;
</content>
</entry>
<entry>
<title>add_update(): initialize the whole ref_update</title>
<updated>2016-06-13T09:23:49Z</updated>
<author>
<name>Michael Haggerty</name>
<email>mhagger@alum.mit.edu</email>
</author>
<published>2016-04-25T09:39:54Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=71564516deccafba0a58129bd7d3851e28fdb4bb'/>
<id>urn:sha1:71564516deccafba0a58129bd7d3851e28fdb4bb</id>
<content type='text'>
Change add_update() to initialize all of the fields in the new
ref_update object. Rename the function to ref_transaction_add_update(),
and increase its visibility to all of the refs-related code.

All of this makes the function more useful for other future callers.

Signed-off-by: Michael Haggerty &lt;mhagger@alum.mit.edu&gt;
</content>
</entry>
<entry>
<title>ref_transaction_create(): disallow recursive pruning</title>
<updated>2016-06-13T09:23:49Z</updated>
<author>
<name>Michael Haggerty</name>
<email>mhagger@alum.mit.edu</email>
</author>
<published>2016-04-24T07:48:26Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=c52ce248d63a185eb0a616b361d1fd72c5c66451'/>
<id>urn:sha1:c52ce248d63a185eb0a616b361d1fd72c5c66451</id>
<content type='text'>
It is nonsensical (and a little bit dangerous) to use REF_ISPRUNING
without REF_NODEREF. Forbid it explicitly. Change the one REF_ISPRUNING
caller to pass REF_NODEREF too.

Signed-off-by: Michael Haggerty &lt;mhagger@alum.mit.edu&gt;
</content>
</entry>
<entry>
<title>refs: make error messages more consistent</title>
<updated>2016-06-13T09:23:49Z</updated>
<author>
<name>Michael Haggerty</name>
<email>mhagger@alum.mit.edu</email>
</author>
<published>2016-04-27T13:21:36Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=0568c8e9dce2aa0dd18f41f23e3465f3639e371e'/>
<id>urn:sha1:0568c8e9dce2aa0dd18f41f23e3465f3639e371e</id>
<content type='text'>
* Always start error messages with a lower-case letter.

* Always enclose reference names in single quotes.

Signed-off-by: Michael Haggerty &lt;mhagger@alum.mit.edu&gt;
</content>
</entry>
<entry>
<title>refname_is_safe(): insist that the refname already be normalized</title>
<updated>2016-05-05T14:37:30Z</updated>
<author>
<name>Michael Haggerty</name>
<email>mhagger@alum.mit.edu</email>
</author>
<published>2016-04-27T10:40:39Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=e40f3557f7e767bd2be2a824bc3bc2379aa69931'/>
<id>urn:sha1:e40f3557f7e767bd2be2a824bc3bc2379aa69931</id>
<content type='text'>
The reference name is going to be compared to other reference names, so
it should be in its normalized form.

Signed-off-by: Michael Haggerty &lt;mhagger@alum.mit.edu&gt;
</content>
</entry>
<entry>
<title>refname_is_safe(): don't allow the empty string</title>
<updated>2016-05-05T14:37:30Z</updated>
<author>
<name>Michael Haggerty</name>
<email>mhagger@alum.mit.edu</email>
</author>
<published>2016-04-27T10:42:27Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=35db25c65f6f77c153ef2b1183ea7821236201c8'/>
<id>urn:sha1:35db25c65f6f77c153ef2b1183ea7821236201c8</id>
<content type='text'>
Signed-off-by: Michael Haggerty &lt;mhagger@alum.mit.edu&gt;
</content>
</entry>
<entry>
<title>refname_is_safe(): use skip_prefix()</title>
<updated>2016-05-05T14:37:30Z</updated>
<author>
<name>Michael Haggerty</name>
<email>mhagger@alum.mit.edu</email>
</author>
<published>2016-04-27T10:39:11Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=39950fef8bb45e944655e48393ee04c0b33211f5'/>
<id>urn:sha1:39950fef8bb45e944655e48393ee04c0b33211f5</id>
<content type='text'>
Signed-off-by: Michael Haggerty &lt;mhagger@alum.mit.edu&gt;
</content>
</entry>
</feed>
