On 08/08, Nguyen Thai Ngoc Duy wrote:
> On Wed, Aug 8, 2012 at 6:17 PM, Thomas Gummerer <t.gumme...@gmail.com> wrote:
> > Move index version 2 specific functions to their own file,
> > to prepare for the addition of a new index file format. With
> > the split into two files we have the non-index specific
> > functions in read-cache.c and the index-v2 specific functions
> > in read-cache-v2.c
> 
> You still mix code changes and code move in one patch, but we can skip
> it for now.
> 
> > --- a/cache.h
> > +++ b/cache.h
> > @@ -267,6 +259,7 @@ struct index_state {
> >         unsigned name_hash_initialized : 1,
> >                  initialized : 1;
> >         struct hash_table name_hash;
> > +       struct index_ops *ops;
> >  };
> 
> Do we really need to modify "ops" content? If not make it "const
> struct index_ops *ops;" which makes..
> 
> > @@ -471,8 +464,8 @@ extern int index_name_is_other(const struct index_state 
> > *, const char *, int);
> >  #define CE_MATCH_RACY_IS_DIRTY         02
> >  /* do stat comparison even if CE_SKIP_WORKTREE is true */
> >  #define CE_MATCH_IGNORE_SKIP_WORKTREE  04
> > -extern int ie_match_stat(const struct index_state *, struct cache_entry *, 
> > struct stat *, unsigned int);
> > -extern int ie_modified(const struct index_state *, struct cache_entry *, 
> > struct stat *, unsigned int);
> > +extern int ie_match_stat(struct index_state *, struct cache_entry *, 
> > struct stat *, unsigned int);
> > +extern int ie_modified(struct index_state *, struct cache_entry *, struct 
> > stat *, unsigned int);
> 
> ..this hunk go away

Unfortunately I think we need to modify it, because in some cases
when ie_modified/ie_match_stat is called, index->ops is not set yet
(happens when the index is empty and thus not read first). Therefore
we have to set it in ce_match_stat_basic to have access to the
format specific match_stat_basic.

We could also call match_stat_basic directly from the v[25]_ops
struct, but I do not think that would be the cleaner solution, or
is there any other way to do it, which I can't see?
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to