Re: Adding a new file as if it had existed

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Johannes Schindelin
Date: Wednesday, December 13, 2006 - 8:46 am

Hi,

On Wed, 13 Dec 2006, Andreas Ericsson wrote:


Okay, I'll have a stab at explaining it.

For huge working directories, you usually have a huge number of trees. The 
idea of cache_tree is to remember not only the stat information of the 
blobs in the index, but to cache the hashes of the trees also (until they 
are invalidated, e.g. by an update-index). This avoids recalculation of 
the hashes when committing.

This cache is accessible by the global variable active_cache_tree. It is 
best accessed by the function cache_tree_find(), which you call like that:

	struct cache_tree *ct = cache_tree_find(active_cache_tree, path);

where the variable "path" may contain slashes. The SHA1 of the 
corresponding tree is in ct->sha1, and you can check if the hash is still 
valid by asking

	if (cache_tree_fully_valid(ct))
		/* still valid */

AFAIU Junio would like to take the shortcut of doing nothing at all when 
(twoway) reading a tree whose hash is identical to the hash stored in the 
corresponding cache_tree _and_ when the cache is still fully valid.

Ciao,
Dscho

-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
Adding a new file as if it had existed, Bahadir Balban, (Tue Dec 12, 3:05 am)
Re: Adding a new file as if it had existed, Junio C Hamano, (Tue Dec 12, 3:13 am)
Re: Adding a new file as if it had existed, Bahadir Balban, (Tue Dec 12, 4:32 am)
Re: Adding a new file as if it had existed, Johannes Schindelin, (Tue Dec 12, 5:07 am)
Re: Adding a new file as if it had existed, Andy Parkins, (Tue Dec 12, 5:26 am)
Re: Adding a new file as if it had existed, Andreas Ericsson, (Tue Dec 12, 6:20 am)
Re: Adding a new file as if it had existed, Junio C Hamano, (Tue Dec 12, 11:31 am)
Re: Adding a new file as if it had existed, Andreas Ericsson, (Wed Dec 13, 2:40 am)
Re: Adding a new file as if it had existed, Johannes Schindelin, (Wed Dec 13, 8:46 am)
Re: Adding a new file as if it had existed, Andreas Ericsson, (Wed Dec 13, 8:52 am)