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

Re: git and symlinks as tracked content

From
Junio C Hamano <junkio@cox.net>
Date
May 5, 2005, 02:13 UTC
Message-ID
<7vy8aul8rs.fsf@assigned-by-dhcp.cox.net>
In-Reply-To
<20050505012051.GA26201@vrfy.org>
>>>>> "KS" == Kay Sievers <kay.sievers@vrfy.org> writes:
>> * It continues to assume that S_IFREG, S_IFDIR and S_IFLNK have
>> the same bit pattern everywhere....
>> * read-cache.c:cache_match_stat() ...
KS> Both included and updated.

The second one, yes, but the first one is "not really". If you are going to do this:

KS> +#define CE_IFREG  0100000
KS> +#define CE_IFDIR  0040000
KS> ...
KS> +#define CE_IFMASK 0770000
 
then you need to touch these things:

KS> + mode = ntohl(ce->ce_mode); KS> + if (S_ISLNK(mode)) {

Here mode encodes type in CE_ format, so S_ISLNK() is bad.

KS> @@ -165,7 +165,7 @@ static void prepare_temp_file(const char KS> } KS> strcpy(temp->hex, sha1_to_hex(null_sha1)); KS> sprintf(temp->mode, "%06o", KS> - S_IFREG |ce_permissions(st.st_mode)); KS> + S_IFREG | ce_permissions(st.st_mode)); KS> }

Likewise here, although this is my bad. I did not know if you are going to take CE_ type suggestion so I left it as it was.

There are more. "grep 'S_I[SF]' *.[ch] */*.[ch]" would tell us most if not all. We probably would want to have CE_ISLNK() and friends, parallel to S_ISLNK() and friends if we go this route.

Does POSIX or something have nice to say that we do not have to worry about this? Or are the stat type bits really different on different Unixen? I used to do porting for living across a dozen or so different Unixen long time ago and I should know the answer to this kind of thing by heart, but I do not anymore X-<.

Previous: Kay SieversNext: Kay Sievers
Message 28 of 29 in “git and symlinks as tracked content”
  1. Kay SieversMay 3, 2005
  2. Linus TorvaldsMay 3, 2005
  3. Morten WelinderMay 3, 2005
  4. H. Peter AnvinMay 3, 2005
  5. Andreas GalMay 3, 2005
  6. Linus TorvaldsMay 3, 2005
  7. Kay SieversMay 3, 2005
  8. Junio C HamanoMay 3, 2005
  9. Andreas GalMay 3, 2005
  10. Junio C HamanoMay 3, 2005
  11. Sym-links, b/c-special files, pipes, ... Scope CreepBrian O'Mahoney, May 4, 2005
  12. H. Peter AnvinMay 3, 2005
  13. Junio C HamanoMay 3, 2005
  14. H. Peter AnvinMay 3, 2005
  15. Linus TorvaldsMay 3, 2005
  16. Junio C HamanoMay 3, 2005
  17. David A. WheelerMay 4, 2005
  18. Daniel BarkalowMay 4, 2005
  19. Alan ChandlerMay 5, 2005
  20. read-only git repositoriesDavid Lang, May 5, 2005
  21. SeanMay 5, 2005
  22. David A. WheelerMay 6, 2005
  23. Daniel BarkalowMay 5, 2005
  24. Junio C HamanoMay 3, 2005
  25. Kay SieversMay 4, 2005
  26. Junio C HamanoMay 4, 2005
  27. Kay SieversMay 5, 2005
  28. Junio C HamanoMay 5, 2005
  29. Kay SieversMay 5, 2005

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.