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

Re: Using GIT to store /etc (Or: How to make GIT store all file permission bits)

From
Shawn O. Pearce <spearce@spearce.org>
Date
Jan 12, 2007, 00:55 UTC
Message-ID
<20070112005546.GD23864@spearce.org>
In-Reply-To
<Pine.LNX.4.63.0701101027480.10339@qynat.qvtvafvgr.pbz>
David Lang <david.lang@digitalinsight.com> wrote:
Show 7 quoted lines
> On Tue, 9 Jan 2007, Shawn O. Pearce wrote:
> >If the stat data is current it will leave it as-is.  You can force
> >the index to refresh with `git update-index --refresh` or by running
> >git status.
> 
> I was looking at checkout, not checkin so I'm not understanding how the 
> index is involved here.
During checkout we use the index to help us decide if a file needs
to be updated with new content or can be left as-is.  Its a cache of
what version each file is at, and its based on the file stat data
(dev, inode, modification date, etc.) to tell us if the file has
been modified or was last created by Git.  If Git was the one that
last modified the file and the version stored in the index matches
the version needed during the checkout, the file is left alone.
But if anything differs then the file gets overwritten.
 
Show 7 quoted lines
> >>does this answer change if there is a trigger on checkout (to change
> >>permissions or otherwise manipulate the file)?
> >
> >Only if the trigger does something in addition, like force overwrite
> >files.  But we don't have a checkout trigger.  So there's no trigger.
> 
> we don't have a checkout trigger?
No.
> I thought that what Linus had suggested 
> for permissions was to have a script triggered on checkin that stored the 
> permissions of the files, and a script triggered on checkout that set the 
> permissions from the stored file.
Yes.  It is what he suggested.
> if there isn't a checkout trigger how would the permissions ever get set?

Someone needs to implement support for a post-checkout trigger. _Then_ a checkout trigger could perform this action.

> in my particular case I'd like to have the checkin run a script that 
> produces a 'generic' version of each file,
You may be able to do that in the pre-commit hook by updating the index
-- 
Shawn.
Previous: David LangNext: Nikolai Weibull
Message 19 of 34 in “Using GIT to store /etc (Or: How to make GIT store all file permission bits)”
  1. Kyle MoffettDec 10, 2006
  2. Jeff GarzikDec 10, 2006
  3. Jakub NarebskiDec 10, 2006
  4. Kyle MoffettDec 10, 2006
  5. Jakub NarebskiDec 10, 2006
  6. Jakub NarebskiDec 10, 2006
  7. Kyle MoffettDec 10, 2006
  8. Andreas EricssonDec 11, 2006
  9. Jeff GarzikDec 11, 2006
  10. Josef WeidendorferDec 11, 2006
  11. Johannes SchindelinDec 11, 2006
  12. Josef WeidendorferDec 11, 2006
  13. Santi BéjarDec 10, 2006
  14. Kyle MoffettDec 10, 2006
  15. Jakub NarebskiDec 10, 2006
  16. David LangJan 10, 2007
  17. Shawn O. PearceJan 10, 2007
  18. David LangJan 10, 2007
  19. Shawn O. PearceJan 12, 2007
  20. Nikolai WeibullDec 11, 2006
  21. Daniel BarkalowDec 12, 2006
  22. Kyle MoffettDec 12, 2006
  23. Andy ParkinsDec 12, 2006
  24. Using git as a general backup mechanism (was Re: Using GIT to store /etc)Steven Grimm, Dec 12, 2006
  25. Johannes SchindelinDec 12, 2006
  26. Steven GrimmDec 12, 2006
  27. Johannes SchindelinDec 13, 2006
  28. Martin LanghoffDec 12, 2006
  29. Martin LanghoffDec 12, 2006
  30. Junio C HamanoDec 12, 2006
  31. Steven GrimmDec 14, 2006
  32. Junio C HamanoDec 15, 2006
  33. Daniel BarkalowDec 13, 2006
  34. Chris RiddochDec 14, 2006

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.