Karsten Blees <karsten.blees@xxxxxxxxx> writes: > 'git checkout' fails if a directory is longer than PATH_MAX, because the > lstat_cache in symlinks.c checks if the leading directory exists using > PATH_MAX-bounded string operations. > > Remove the limitation by using strbuf instead. Good. > diff --git a/cache.h b/cache.h > index df65231..44aa439 100644 > --- a/cache.h > +++ b/cache.h > @@ -1090,12 +1090,16 @@ struct checkout { > extern int checkout_entry(struct cache_entry *ce, const struct checkout *state, char *topath); > > struct cache_def { > - char path[PATH_MAX + 1]; > - int len; > + struct strbuf path; > int flags; > int track_flags; > int prefix_len_stat_func; > }; > +#define CACHE_DEF_INIT { STRBUF_INIT, 0, 0, 0 } > +static inline void cache_def_free(struct cache_def *cache) > +{ > + strbuf_release(&cache->path); > +} The above cache_def_free(cache) does not free the cache itself, but only its associated data, so the name cache_def_free() is somewhat misleading. It seems that we use the name that consists solely of "something" and "free" if the pointer to "something" itself is also freed. For example "diff_free_filespec_data(struct diff_filespec *)" frees data associated with the filespec but not the filespec itself, which is done with "diff_free_filespec()". Another name that may not be misleading would be cache_def_clear(); I think I'd prefer it over cache_def_free_data(). -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html