Re: Problem with S_IFGITLINK
- From
Nguyen Thai Ngoc Duy <pclouds@gmail.com>
- Date
- Aug 24, 2011, 23:15 UTC
- Message-ID
- <CACsJy8Dgz92YqBnqjvMS9KqtNoNTyrP_0ZqEqTurGnVfTzriUQ@mail.gmail.com>
- In-Reply-To
- <4E551904.303@gmail.com>
2011/8/24 Adam Kłobukowski <adamklobukowski@gmail.com>:
> I may try to implement it, but I my knowledge of Git internals is equal to > zero. If someone can point me what has to be done - I'll be gratefull.
Git stores mode in the index (struct cache_entry#ce_mode, cache.h) and in tree objects (see tree-walk.c). Basically you define a new set of S_IS* and S_IF* macros and use them instead of standard ones. Translations from struct stat#st_mode will be needed, I think ce_mode_from_stat() does that job.
So: - read index and checkout: entry.c - read and update index: read-cache.c - read tree objects: tree-walk.c - write tree objects: cache-tree.c - anywhere that checks struct cache_entry#ce_mode needs to convert to use the new defines
Another way, less changes, is redefine S_IS* and S_IF* and ignore system values. Then make wrapper for stat() and lstat(), convert system values to git values. You can put these wrappers in compat directory. See git-compat-util.h, mingw port for example already redefine these functions for Windows platform.
-- Duy