git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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
Previous: Adam KłobukowskiNext: Michael Schubert
Message 4 of 6 in “Problem with S_IFGITLINK”
  1. Adam KłobukowskiAug 24, 2011
  2. Michael J GruberAug 24, 2011
  3. Adam KłobukowskiAug 24, 2011
  4. Nguyen Thai Ngoc DuyAug 24, 2011
  5. Michael SchubertAug 24, 2011
  6. Adam KłobukowskiAug 24, 2011

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.