<feed xmlns='http://www.w3.org/2005/Atom'>
<title>git/test-dump-cache-tree.c, branch v2.8.2</title>
<subtitle>Mirror of https://git.kernel.org/pub/scm/git/git.git/
</subtitle>
<id>https://git.shady.money/git/atom?h=v2.8.2</id>
<link rel='self' href='https://git.shady.money/git/atom?h=v2.8.2'/>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/'/>
<updated>2015-09-25T17:18:18Z</updated>
<entry>
<title>test-dump-cache-tree: avoid overflow of cache-tree name</title>
<updated>2015-09-25T17:18:18Z</updated>
<author>
<name>Jeff King</name>
<email>peff@peff.net</email>
</author>
<published>2015-09-24T21:06:03Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=04724222d5aad4da48674e69aab715273f05dded'/>
<id>urn:sha1:04724222d5aad4da48674e69aab715273f05dded</id>
<content type='text'>
When dumping a cache-tree, we sprintf sub-tree names directly
into a fixed-size buffer, which can overflow. We can
trivially fix this by converting to xsnprintf to at least
notice and die.

This probably should handle arbitrary-sized names, but
there's not much point. It's used only by the test scripts,
so the trivial fix is enough.

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 'dt/cache-tree-repair'</title>
<updated>2014-09-11T17:33:32Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2014-09-11T17:33:32Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=3fd13cbcd58f078476cabab926931a3d5bdedfe2'/>
<id>urn:sha1:3fd13cbcd58f078476cabab926931a3d5bdedfe2</id>
<content type='text'>
Add a few more places in "commit" and "checkout" that make sure
that the cache-tree is fully populated in the index.

* dt/cache-tree-repair:
  cache-tree: do not try to use an invalidated subtree info to build a tree
  cache-tree: Write updated cache-tree after commit
  cache-tree: subdirectory tests
  test-dump-cache-tree: invalid trees are not errors
  cache-tree: create/update cache-tree on checkout
</content>
</entry>
<entry>
<title>test-dump-cache-tree: invalid trees are not errors</title>
<updated>2014-07-08T17:35:11Z</updated>
<author>
<name>David Turner</name>
<email>dturner@twopensource.com</email>
</author>
<published>2014-07-08T00:33:43Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=969dd8c612b3b22c4080ffd4448cef4accbf428b'/>
<id>urn:sha1:969dd8c612b3b22c4080ffd4448cef4accbf428b</id>
<content type='text'>
Do not treat known-invalid trees as errors even when their subtree_nr is
incorrect.  Because git already knows that these trees are invalid,
an incorrect subtree_nr will not cause problems.

Add a couple of comments.

Signed-off-by: David Turner &lt;dturner@twitter.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>cache-tree: mark istate-&gt;cache_changed on cache tree update</title>
<updated>2014-06-13T18:49:39Z</updated>
<author>
<name>Nguyễn Thái Ngọc Duy</name>
<email>pclouds@gmail.com</email>
</author>
<published>2014-06-13T12:19:32Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=d0cfc3e866a77eed98ab2caf41a39a87837950e6'/>
<id>urn:sha1:d0cfc3e866a77eed98ab2caf41a39a87837950e6</id>
<content type='text'>
Signed-off-by: Nguyễn Thái Ngọc Duy &lt;pclouds@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>Convert "struct cache_entry *" to "const ..." wherever possible</title>
<updated>2013-07-09T16:12:48Z</updated>
<author>
<name>Nguyễn Thái Ngọc Duy</name>
<email>pclouds@gmail.com</email>
</author>
<published>2013-07-09T15:29:00Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=9c5e6c802cde9881785b7f1b3278b97be4aabd82'/>
<id>urn:sha1:9c5e6c802cde9881785b7f1b3278b97be4aabd82</id>
<content type='text'>
I attempted to make index_state-&gt;cache[] a "const struct cache_entry **"
to find out how existing entries in index are modified and where. The
question I have is what do we do if we really need to keep track of on-disk
changes in the index. The result is

 - diff-lib.c: setting CE_UPTODATE

 - name-hash.c: setting CE_HASHED

 - preload-index.c, read-cache.c, unpack-trees.c and
   builtin/update-index: obvious

 - entry.c: write_entry() may refresh the checked out entry via
   fill_stat_cache_info(). This causes "non-const struct cache_entry
   *" in builtin/apply.c, builtin/checkout-index.c and
   builtin/checkout.c

 - builtin/ls-files.c: --with-tree changes stagemask and may set
   CE_UPDATE

Of these, write_entry() and its call sites are probably most
interesting because it modifies on-disk info. But this is stat info
and can be retrieved via refresh, at least for porcelain
commands. Other just uses ce_flags for local purposes.

So, keeping track of "dirty" entries is just a matter of setting a
flag in index modification functions exposed by read-cache.c. Except
unpack-trees, the rest of the code base does not do anything funny
behind read-cache's back.

The actual patch is less valueable than the summary above. But if
anyone wants to re-identify the above sites. Applying this patch, then
this:

    diff --git a/cache.h b/cache.h
    index 430d021..1692891 100644
    --- a/cache.h
    +++ b/cache.h
    @@ -267,7 +267,7 @@ static inline unsigned int canon_mode(unsigned int mode)
     #define cache_entry_size(len) (offsetof(struct cache_entry,name) + (len) + 1)

     struct index_state {
    -	struct cache_entry **cache;
    +	const struct cache_entry **cache;
     	unsigned int version;
     	unsigned int cache_nr, cache_alloc, cache_changed;
     	struct string_list *resolve_undo;

will help quickly identify them without bogus warnings.

Signed-off-by: Nguyễn Thái Ngọc Duy &lt;pclouds@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>cache-tree: update API to take abitrary flags</title>
<updated>2012-02-08T00:35:43Z</updated>
<author>
<name>Nguyễn Thái Ngọc Duy</name>
<email>pclouds@gmail.com</email>
</author>
<published>2012-01-16T02:36:46Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=e859c69b26528a55bd64f4eee2ed06fad999d862'/>
<id>urn:sha1:e859c69b26528a55bd64f4eee2ed06fad999d862</id>
<content type='text'>
Signed-off-by: Nguyễn Thái Ngọc Duy &lt;pclouds@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>Refactor cache_tree_update idiom from commit</title>
<updated>2011-12-06T22:57:36Z</updated>
<author>
<name>Thomas Rast</name>
<email>trast@student.ethz.ch</email>
</author>
<published>2011-12-06T17:43:37Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=996277c520641d650dc15ad751cc4ad33318e298'/>
<id>urn:sha1:996277c520641d650dc15ad751cc4ad33318e298</id>
<content type='text'>
We'll need to safely create or update the cache-tree data of the_index
from other places.  While at it, give it an argument that lets us
silence the messages produced by unmerged entries (which prevent it
from working).

Signed-off-by: Thomas Rast &lt;trast@student.ethz.ch&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>add test-dump-cache-tree in Makefile</title>
<updated>2009-02-04T06:11:44Z</updated>
<author>
<name>Guanqun Lu</name>
<email>guanqun.lu@gmail.com</email>
</author>
<published>2009-02-04T21:00:41Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=37fc57a213c5dd7a15dfdf571ce4a58de124cb0f'/>
<id>urn:sha1:37fc57a213c5dd7a15dfdf571ce4a58de124cb0f</id>
<content type='text'>
5c5ba73 (Makefile: Use generic rule to build test programs,
2007-05-31) tried to use generic rule to build test programs, but it
misses the file 'dump-cache-tree.c', since its name is not prefixed by
'test-'.  This commit solves this little problem by renaming this file
instead of carrying out an explicit rule in Makefile.

Signed-off-by: Guanqun Lu &lt;guanqun.lu@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
</feed>
