<feed xmlns='http://www.w3.org/2005/Atom'>
<title>git/refs/ref-cache.c, branch v2.16.2</title>
<subtitle>Mirror of https://git.kernel.org/pub/scm/git/git.git/
</subtitle>
<id>https://git.shady.money/git/atom?h=v2.16.2</id>
<link rel='self' href='https://git.shady.money/git/atom?h=v2.16.2'/>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/'/>
<updated>2017-11-06T01:31:08Z</updated>
<entry>
<title>refs: update some more docs to use "oid" rather than "sha1"</title>
<updated>2017-11-06T01:31:08Z</updated>
<author>
<name>Michael Haggerty</name>
<email>mhagger@alum.mit.edu</email>
</author>
<published>2017-11-05T08:42:09Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=78fb457968591887ebb331d3d0475c00c7dbb317'/>
<id>urn:sha1:78fb457968591887ebb331d3d0475c00c7dbb317</id>
<content type='text'>
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>refs: convert peel_object to struct object_id</title>
<updated>2017-10-16T02:05:52Z</updated>
<author>
<name>brian m. carlson</name>
<email>sandals@crustytoothpaste.net</email>
</author>
<published>2017-10-15T22:07:10Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=ac2ed0d7d51e5c0b402797ecf01f38e9bfc82e0e'/>
<id>urn:sha1:ac2ed0d7d51e5c0b402797ecf01f38e9bfc82e0e</id>
<content type='text'>
Signed-off-by: brian m. carlson &lt;sandals@crustytoothpaste.net&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>ref_cache: remove support for storing peeled values</title>
<updated>2017-09-25T09:02:46Z</updated>
<author>
<name>Michael Haggerty</name>
<email>mhagger@alum.mit.edu</email>
</author>
<published>2017-09-25T08:00:16Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=a6e19bcdadf782079cf88609b928519c2dee3378'/>
<id>urn:sha1:a6e19bcdadf782079cf88609b928519c2dee3378</id>
<content type='text'>
Now that the `packed-refs` backend doesn't use `ref_cache`, there is
nobody left who might want to store peeled values of references in
`ref_cache`. So remove that feature.

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_iterator: keep track of whether the iterator output is ordered</title>
<updated>2017-09-14T06:19:07Z</updated>
<author>
<name>Michael Haggerty</name>
<email>mhagger@alum.mit.edu</email>
</author>
<published>2017-09-13T17:15:55Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=8738a8a4df9ee50112b5f5a757c58988166974d3'/>
<id>urn:sha1:8738a8a4df9ee50112b5f5a757c58988166974d3</id>
<content type='text'>
References are iterated over in order by refname, but reflogs are not.
Some consumers of reference iteration care about the difference. Teach
each `ref_iterator` to keep track of whether its output is ordered.

`overlay_ref_iterator` is one of the picky consumers. Add a sanity
check in `overlay_ref_iterator_begin()` to verify that its inputs are
ordered.

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>*.[ch] refactoring: make use of the FREE_AND_NULL() macro</title>
<updated>2017-06-16T19:44:09Z</updated>
<author>
<name>Ævar Arnfjörð Bjarmason</name>
<email>avarab@gmail.com</email>
</author>
<published>2017-06-15T23:15:49Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=88ce3ef636b1385e861ec0e9e2155248b999b032'/>
<id>urn:sha1:88ce3ef636b1385e861ec0e9e2155248b999b032</id>
<content type='text'>
Replace occurrences of `free(ptr); ptr = NULL` which weren't caught by
the coccinelle rule. These fall into two categories:

 - free/NULL assignments one after the other which coccinelle all put
   on one line, which is functionally equivalent code, but very ugly.

 - manually spotted occurrences where the NULL assignment isn't right
   after the free() call.

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>cache_ref_iterator_begin(): avoid priming unneeded directories</title>
<updated>2017-05-24T12:21:21Z</updated>
<author>
<name>Michael Haggerty</name>
<email>mhagger@alum.mit.edu</email>
</author>
<published>2017-05-22T14:17:55Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=f23092f19e73f5d8c3480ef02104af627a90361f'/>
<id>urn:sha1:f23092f19e73f5d8c3480ef02104af627a90361f</id>
<content type='text'>
When iterating over references, reference priming is used to make sure
that loose references are read into the ref-cache before packed
references, to avoid races. It used to be that the prefix passed to
reference iterators almost always ended in `/`, for example
`refs/heads/`. In that case, the priming code would read all loose
references under `find_containing_dir("refs/heads/")`, which is
"refs/heads/". That's just what we want.

But now that `ref-filter` knows how to pass refname prefixes to
`for_each_fullref_in()`, the prefix might come from user input; for
example,

    git for-each-ref refs/heads

Since the argument doesn't include a trailing slash, the reference
iteration code would prime all of the loose references under
`find_containing_dir("refs/heads")`, which is "refs/". Thus we would
unnecessarily read tags, remote-tracking references, etc., when the
user is only interested in branches.

It is a bit awkward to get around this problem. We can't just append a
slash to the argument, because we don't know ab initio whether an
argument like `refs/tags/release` corresponds to a single tag or to a
directory containing tags.

Moreover, until now a `prefix_ref_iterator` was used to make the final
decision about which references fall within the prefix (the
`cache_ref_iterator` only did a rough cut). This is also inefficient,
because the `prefix_ref_iterator` can't know, for example, that while
you are in a subdirectory that is completely within the prefix, you
don't have to do the prefix check.

So:

* Move the responsibility for doing the prefix check directly to
  `cache_ref_iterator`. This means that `cache_ref_iterator_begin()`
  never has to wrap its return value in a `prefix_ref_iterator`.

* Teach `cache_ref_iterator_begin()` (and `prime_ref_dir()`) to be
  stricter about what they iterate over and what directories they
  prime.

* Teach `cache_ref_iterator` to keep track of whether the current
  `cache_ref_iterator_level` is fully within the prefix. If so, skip
  the prefix checks entirely.

The main benefit of these optimizations is for loose references, since
packed references are always read all at once.

Note that after this change, `prefix_ref_iterator` is only ever used
for its trimming feature and not for its "prefix" feature. But I'm not
ripping out the latter yet, because it might be useful for another
patch series that I'm working on.

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_ref_entry(): remove `check_name` option</title>
<updated>2017-05-23T05:29:56Z</updated>
<author>
<name>Michael Haggerty</name>
<email>mhagger@alum.mit.edu</email>
</author>
<published>2017-05-22T14:17:53Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=c1da06c6f1a77370341d93d80af027caa6a19a94'/>
<id>urn:sha1:c1da06c6f1a77370341d93d80af027caa6a19a94</id>
<content type='text'>
Only one caller was using it, so move the check to that caller.

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>refs/files-backend: convert many internals to struct object_id</title>
<updated>2017-05-08T06:12:58Z</updated>
<author>
<name>brian m. carlson</name>
<email>sandals@crustytoothpaste.net</email>
</author>
<published>2017-05-06T22:10:24Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=4417df8c492489613d031478ba2e3604f65a5f84'/>
<id>urn:sha1:4417df8c492489613d031478ba2e3604f65a5f84</id>
<content type='text'>
Convert many of the internals of the files backend to use struct
object_id.  Avoid converting public APIs (except one change to
refs/ref-cache.c) to limit the scope of the changes.

Convert one use of get_sha1_hex to parse_oid_hex, and rely on the fact
that a strbuf will be NUL-terminated and that parse_oid_hex will fail on
truncated input to avoid the need to check the length.

This is a requirement to convert parse_object later on.

Signed-off-by: brian m. carlson &lt;sandals@crustytoothpaste.net&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>do_for_each_entry_in_dir(): delete function</title>
<updated>2017-04-17T04:32:46Z</updated>
<author>
<name>Michael Haggerty</name>
<email>mhagger@alum.mit.edu</email>
</author>
<published>2017-04-16T06:41:42Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=f890db83ee426f4bda0458728e813e45cc8531a7'/>
<id>urn:sha1:f890db83ee426f4bda0458728e813e45cc8531a7</id>
<content type='text'>
Its only remaining caller was itself.

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>cache_ref_iterator_begin(): make function smarter</title>
<updated>2017-04-17T04:32:46Z</updated>
<author>
<name>Michael Haggerty</name>
<email>mhagger@alum.mit.edu</email>
</author>
<published>2017-04-16T06:41:39Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=059ae35a4871428f49500a22fd0b3eb6e1b424c3'/>
<id>urn:sha1:059ae35a4871428f49500a22fd0b3eb6e1b424c3</id>
<content type='text'>
Change `cache_ref_iterator_begin()` to take two new arguments:

* `prefix` -- to iterate only over references with the specified
  prefix.

* `prime_dir` -- to "prime" (i.e., pre-load) the cache before starting
  the iteration.

The new functionality makes it possible for
`files_ref_iterator_begin()` to be made more ignorant of the internals
of `ref_cache`, and `find_containing_dir()` and `prime_ref_dir()` to
be made private.

Signed-off-by: Michael Haggerty &lt;mhagger@alum.mit.edu&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
</feed>
