<feed xmlns='http://www.w3.org/2005/Atom'>
<title>git/object.c, branch v2.4.9</title>
<subtitle>Mirror of https://git.kernel.org/pub/scm/git/git.git/
</subtitle>
<id>https://git.shady.money/git/atom?h=v2.4.9</id>
<link rel='self' href='https://git.shady.money/git/atom?h=v2.4.9'/>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/'/>
<updated>2015-05-13T21:05:54Z</updated>
<entry>
<title>Merge branch 'jk/type-from-string-gently' into maint</title>
<updated>2015-05-13T21:05:54Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2015-05-13T21:05:54Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=c1c4a878bb70b6f46550ab370bba320a3a5dda70'/>
<id>urn:sha1:c1c4a878bb70b6f46550ab370bba320a3a5dda70</id>
<content type='text'>
"git cat-file bl $blob" failed to barf even though there is no
object type that is "bl".

* jk/type-from-string-gently:
  type_from_string_gently: make sure length matches
</content>
</entry>
<entry>
<title>type_from_string_gently: make sure length matches</title>
<updated>2015-04-17T20:54:39Z</updated>
<author>
<name>Jeff King</name>
<email>peff@peff.net</email>
</author>
<published>2015-04-17T14:52:48Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=b7994af0f92e6cf150544aebe3c3fc526faaf2c3'/>
<id>urn:sha1:b7994af0f92e6cf150544aebe3c3fc526faaf2c3</id>
<content type='text'>
When commit fe8e3b7 refactored type_from_string to allow
input that was not NUL-terminated, it switched to using
strncmp instead of strcmp. But this means we check only the
first "len" bytes of the strings, and ignore any remaining
bytes in the object_type_string. We should make sure that it
is also "len" bytes, or else we would accept "comm" as
"commit", and so forth.

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>drop add_object_array_with_mode</title>
<updated>2014-10-19T22:28:30Z</updated>
<author>
<name>Jeff King</name>
<email>peff@peff.net</email>
</author>
<published>2014-10-19T02:03:19Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=189a1222493f73977291f57d0f2030e982aff282'/>
<id>urn:sha1:189a1222493f73977291f57d0f2030e982aff282</id>
<content type='text'>
This is a thin compatibility wrapper around
add_pending_object_with_path. But the only caller is
add_object_array, which is itself just a thin compatibility
wrapper. There are no external callers, so we can just
remove this middle wrapper.

Noticed-by: Ramsay Jones &lt;ramsay@ramsay1.demon.co.uk&gt;
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>make add_object_array_with_context interface more sane</title>
<updated>2014-10-16T17:10:44Z</updated>
<author>
<name>Jeff King</name>
<email>peff@peff.net</email>
</author>
<published>2014-10-15T22:42:57Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=9e0c3c4fcdf3775a9e0256ee231efa4698297a0e'/>
<id>urn:sha1:9e0c3c4fcdf3775a9e0256ee231efa4698297a0e</id>
<content type='text'>
When you resolve a sha1, you can optionally keep any context
found during the resolution, including the path and mode of
a tree entry (e.g., when looking up "HEAD:subdir/file.c").

The add_object_array_with_context function lets you then
attach that context to an entry in a list. Unfortunately,
the interface for doing so is horrible. The object_context
structure is large and most object_array users do not use
it. Therefore we keep a pointer to the structure to avoid
burdening other users too much. But that means when we do
use it that we must allocate the struct ourselves. And the
struct contains a fixed PATH_MAX-sized buffer, which makes
this wholly unsuitable for any large arrays.

We can observe that there is only a single user of the
"with_context" variant: builtin/grep.c. And in that use
case, the only element we care about is the path. We can
therefore store only the path as a pointer (the context's
mode field was redundant with the object_array_entry itself,
and nobody actually cared about the surrounding tree). This
still requires a strdup of the pathname, but at least we are
only consuming the minimum amount of memory for each string.

We can also handle the copying ourselves in
add_object_array_*, and free it as appropriate in
object_array_release_entry.

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>object_array: add a "clear" function</title>
<updated>2014-10-16T17:10:37Z</updated>
<author>
<name>Jeff King</name>
<email>peff@peff.net</email>
</author>
<published>2014-10-15T22:34:34Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=46be823124bb6a6ff0e06dc19c327b599ed97c72'/>
<id>urn:sha1:46be823124bb6a6ff0e06dc19c327b599ed97c72</id>
<content type='text'>
There's currently no easy way to free the memory associated
with an object_array (and in most cases, we simply leak the
memory in a rev_info's pending array). Let's provide a
helper to make this easier to handle.

We can make use of it in list-objects.c, which does the same
thing by hand (but fails to free the "name" field of each
entry, potentially leaking memory).

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>object_array: factor out slopbuf-freeing logic</title>
<updated>2014-10-16T17:10:36Z</updated>
<author>
<name>Jeff King</name>
<email>peff@peff.net</email>
</author>
<published>2014-10-15T22:34:19Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=68f492359e29bbdf633201406d0646deee2b298c'/>
<id>urn:sha1:68f492359e29bbdf633201406d0646deee2b298c</id>
<content type='text'>
This is not a lot of code, but it's a logical construct that
should not need to be repeated (and we are about to add a
third repetition).

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>Merge branch 'rs/realloc-array'</title>
<updated>2014-09-26T21:39:45Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2014-09-26T21:39:45Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=1c2ea2cdc0e8c4e5af942c51b234c5af527944f6'/>
<id>urn:sha1:1c2ea2cdc0e8c4e5af942c51b234c5af527944f6</id>
<content type='text'>
Code cleanup.

* rs/realloc-array:
  use REALLOC_ARRAY for changing the allocation size of arrays
  add macro REALLOC_ARRAY
</content>
</entry>
<entry>
<title>use REALLOC_ARRAY for changing the allocation size of arrays</title>
<updated>2014-09-18T16:13:42Z</updated>
<author>
<name>René Scharfe</name>
<email>l.s.r@web.de</email>
</author>
<published>2014-09-16T18:56:57Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=2756ca4347cbda05b16954cd7f445c216b935e76'/>
<id>urn:sha1:2756ca4347cbda05b16954cd7f445c216b935e76</id>
<content type='text'>
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>
<entry>
<title>Refactor type_from_string() to allow continuing after detecting an error</title>
<updated>2014-09-10T20:52:13Z</updated>
<author>
<name>Johannes Schindelin</name>
<email>johannes.schindelin@gmx.de</email>
</author>
<published>2014-09-10T13:52:44Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=fe8e3b71805cd13d139b62fa5a0c75387568c9ea'/>
<id>urn:sha1:fe8e3b71805cd13d139b62fa5a0c75387568c9ea</id>
<content type='text'>
In the next commits, we will enhance the fsck_tag() function to check
tag objects more thoroughly. To this end, we need a function to verify
that a given string is a valid object type, but that does not die() in
the negative case.

While at it, prepare type_from_string() for counted strings, i.e. strings
with an explicitly specified length rather than a NUL termination.

Signed-off-by: Johannes Schindelin &lt;johannes.schindelin@gmx.de&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>Merge branch 'jk/alloc-commit-id'</title>
<updated>2014-07-22T17:59:25Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2014-07-22T17:59:24Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=10b944b37b11d6e0597541efdd1fa23c0eecbeff'/>
<id>urn:sha1:10b944b37b11d6e0597541efdd1fa23c0eecbeff</id>
<content type='text'>
Make sure all in-core commit objects are assigned a unique number
so that they can be annotated using the commit-slab API.

* jk/alloc-commit-id:
  diff-tree: avoid lookup_unknown_object
  object_as_type: set commit index
  alloc: factor out commit index
  add object_as_type helper for casting objects
  parse_object_buffer: do not set object type
  move setting of object-&gt;type to alloc_* functions
  alloc: write out allocator definitions
  alloc.c: remove the alloc_raw_commit_node() function
</content>
</entry>
</feed>
