<feed xmlns='http://www.w3.org/2005/Atom'>
<title>git, branch v2.0.4</title>
<subtitle>Mirror of https://git.kernel.org/pub/scm/git/git.git/
</subtitle>
<id>https://git.shady.money/git/atom?h=v2.0.4</id>
<link rel='self' href='https://git.shady.money/git/atom?h=v2.0.4'/>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/'/>
<updated>2014-07-30T21:19:53Z</updated>
<entry>
<title>Git 2.0.4</title>
<updated>2014-07-30T21:19:53Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2014-07-30T21:19:53Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=32f56600bb6ac6fc57183e79d2c1515dfa56672f'/>
<id>urn:sha1:32f56600bb6ac6fc57183e79d2c1515dfa56672f</id>
<content type='text'>
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>commit --amend: test specifies authorship but forgets to check</title>
<updated>2014-07-30T18:32:12Z</updated>
<author>
<name>Fabian Ruch</name>
<email>bafain@gmail.com</email>
</author>
<published>2014-07-30T09:45:11Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=d8b396e17ecfe28b39b5f4470f791c434cce40ec'/>
<id>urn:sha1:d8b396e17ecfe28b39b5f4470f791c434cce40ec</id>
<content type='text'>
The test case "--amend option copies authorship" specifies that the
git-commit option `--amend` uses the authorship of the replaced
commit for the new commit. Add the omitted check that this property
actually holds.

Signed-off-by: Fabian Ruch &lt;bafain@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>t4013: test diff-tree's --stdin commit formatting</title>
<updated>2014-07-28T18:31:32Z</updated>
<author>
<name>Jeff King</name>
<email>peff@peff.net</email>
</author>
<published>2014-07-28T18:01:57Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=d299e9e550c1bf8640907fdba1f03cc585ee71df'/>
<id>urn:sha1:d299e9e550c1bf8640907fdba1f03cc585ee71df</id>
<content type='text'>
Once upon a time, git-log was just "rev-list | diff-tree",
and we did not bother to test it separately. These days git-log
is implemented internally, but we want to make sure that the
rev-list to diff-tree pipeline continues to function. Let's
add a basic sanity test.

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 'jk/alloc-commit-id-maint' into maint</title>
<updated>2014-07-28T17:35:35Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2014-07-28T17:35:35Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=5d7c37a130833d8e612f6b83f017ffe51a1a6833'/>
<id>urn:sha1:5d7c37a130833d8e612f6b83f017ffe51a1a6833</id>
<content type='text'>
* jk/alloc-commit-id-maint:
  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>
<entry>
<title>diff-tree: avoid lookup_unknown_object</title>
<updated>2014-07-28T17:14:34Z</updated>
<author>
<name>Jeff King</name>
<email>peff@peff.net</email>
</author>
<published>2014-07-13T06:42:17Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=b794ebeac9151af4a9136ef28a22a06c2afb17cc'/>
<id>urn:sha1:b794ebeac9151af4a9136ef28a22a06c2afb17cc</id>
<content type='text'>
We generally want to avoid lookup_unknown_object, because it
results in allocating more memory for the object than may be
strictly necessary.

In this case, it is used to check whether we have an
already-parsed object before calling parse_object, to save
us from reading the object from disk. Using lookup_object
would be fine for that purpose, but we can take it a step
further. Since this code was written, parse_object already
learned the "check lookup_object" optimization, so we can
simply call parse_object directly.

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_as_type: set commit index</title>
<updated>2014-07-28T17:14:34Z</updated>
<author>
<name>Jeff King</name>
<email>peff@peff.net</email>
</author>
<published>2014-07-13T06:42:12Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=34dfe197a93763ec9c5d25eec499777cbb32b6fd'/>
<id>urn:sha1:34dfe197a93763ec9c5d25eec499777cbb32b6fd</id>
<content type='text'>
The point of the "index" field of struct commit is that
every allocated commit would have one. It is supposed to be
an invariant that whenever object-&gt;type is set to
OBJ_COMMIT, we have a unique index.

Commit 969eba6 (commit: push commit_index update into
alloc_commit_node, 2014-06-10) covered this case for
newly-allocated commits. However, we may also allocate an
"unknown" object via lookup_unknown_object, and only later
convert it to a commit. We must make sure that we set the
commit index when we switch the type field.

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>alloc: factor out commit index</title>
<updated>2014-07-28T17:14:33Z</updated>
<author>
<name>Jeff King</name>
<email>peff@peff.net</email>
</author>
<published>2014-07-13T06:42:08Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=5de7f500c13c8158696a68d86da1030313ddaf69'/>
<id>urn:sha1:5de7f500c13c8158696a68d86da1030313ddaf69</id>
<content type='text'>
We keep a static counter to set the commit index on newly
allocated objects. However, since we also need to set the
index on any_objects which are converted to commits, let's
make the counter available as a public function.

While we're moving it, let's make sure the counter is
allocated as an unsigned integer to match the index field in
"struct commit".

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>add object_as_type helper for casting objects</title>
<updated>2014-07-28T17:14:33Z</updated>
<author>
<name>Jeff King</name>
<email>peff@peff.net</email>
</author>
<published>2014-07-13T06:42:03Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=c4ad00f8ccb59a0ae0735e8e32b203d4bd835616'/>
<id>urn:sha1:c4ad00f8ccb59a0ae0735e8e32b203d4bd835616</id>
<content type='text'>
When we call lookup_commit, lookup_tree, etc, the logic goes
something like:

  1. Look for an existing object struct. If we don't have
     one, allocate and return a new one.

  2. Double check that any object we have is the expected
     type (and complain and return NULL otherwise).

  3. Convert an object with type OBJ_NONE (from a prior
     call to lookup_unknown_object) to the expected type.

We can encapsulate steps 2 and 3 in a helper function which
checks whether we have the expected object type, converts
OBJ_NONE as appropriate, and returns the object.

Not only does this shorten the code, but it also provides
one central location for converting OBJ_NONE objects into
objects of other types. Future patches will use that to
enforce type-specific invariants.

Since this is a refactoring, we would want it to behave
exactly as the current code. It takes a little reasoning to
see that this is the case:

  - for lookup_{commit,tree,etc} functions, we are just
    pulling steps 2 and 3 into a function that does the same
    thing.

  - for the call in peel_object, we currently only do step 3
    (but we want to consolidate it with the others, as
    mentioned above). However, step 2 is a noop here, as the
    surrounding conditional makes sure we have OBJ_NONE
    (which we want to keep to avoid an extraneous call to
    sha1_object_info).

  - for the call in lookup_commit_reference_gently, we are
    currently doing step 2 but not step 3. However, step 3
    is a noop here. The object we got will have just come
    from deref_tag, which must have figured out the type for
    each object in order to know when to stop peeling.
    Therefore the type will never be OBJ_NONE.

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>parse_object_buffer: do not set object type</title>
<updated>2014-07-28T17:14:33Z</updated>
<author>
<name>Jeff King</name>
<email>peff@peff.net</email>
</author>
<published>2014-07-13T06:42:00Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=fe0444b50b400a2c0b6263e8bd6ba464fea0ed4f'/>
<id>urn:sha1:fe0444b50b400a2c0b6263e8bd6ba464fea0ed4f</id>
<content type='text'>
The only way that "obj" can be non-NULL is if it came from
one of the lookup_* functions. These functions always ensure
that the object has the expected type (and return NULL
otherwise), so there is no need for us to set the type.

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>move setting of object-&gt;type to alloc_* functions</title>
<updated>2014-07-28T17:14:33Z</updated>
<author>
<name>Jeff King</name>
<email>peff@peff.net</email>
</author>
<published>2014-07-13T06:41:55Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=fe24d396e1b8d2eedbc07f626af3dcd2b14e6012'/>
<id>urn:sha1:fe24d396e1b8d2eedbc07f626af3dcd2b14e6012</id>
<content type='text'>
The "struct object" type implements basic object
polymorphism.  Individual instances are allocated as
concrete types (or as a union type that can store any
object), and a "struct object *" can be cast into its real
type after examining its "type" enum.  This means it is
dangerous to have a type field that does not match the
allocation (e.g., setting the type field of a "struct blob"
to "OBJ_COMMIT" would mean that a reader might read past the
allocated memory).

In most of the current code this is not a problem; the first
thing we do after allocating an object is usually to set its
type field by passing it to create_object. However, the
virtual commits we create in merge-recursive.c do not ever
get their type set. This does not seem to have caused
problems in practice, though (presumably because we always
pass around a "struct commit" pointer and never even look at
the type).

We can fix this oversight and also make it harder for future
code to get it wrong by setting the type directly in the
object allocation functions.

This will also make it easier to fix problems with commit
index allocation, as we know that any object allocated by
alloc_commit_node will meet the invariant that an object
with an OBJ_COMMIT type field will have a unique index
number.

Signed-off-by: Jeff King &lt;peff@peff.net&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
</feed>
