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
Daniel Barkalow <barkalow@iabervon.org>
Date
Dec 12, 2006, 03:45 UTC
Message-ID
<Pine.LNX.4.64.0612111837210.20138@iabervon.org>
In-Reply-To
<787BE48C-1808-4A33-A368-5E8A3F00C787@mac.com>
On Sun, 10 Dec 2006, Kyle Moffett wrote:
Show 15 quoted lines
> I've recently become somewhat interested in the idea of using GIT to store the
> contents of various folders in /etc.  However after a bit of playing with
> this, I discovered that GIT doesn't actually preserve all permission bits
> since that would cause problems with the more traditional software development
> model.  I'm curious if anyone has done this before; and if so, how they went
> about handling the permissions and ownership issues.
> 
> I spent a little time looking over how GIT stores and compares permission
> bits; trying to figure out if it's possible to patch in a new configuration
> variable or two; say "preserve_all_perms" and "preserve_owner", or maybe even
> "save_acls".  It looks like standard permission preservation is fairly basic;
> you would just need to patch a few routines which alter the permissions read
> in from disk or compare them with ones from the database.  On the other hand,
> it would appear that preserving ownership or full POSIX ACLs might be a bit of
> a challenge.

The first thing you'd want to do is correct the fact that the index doesn't keep full permissions. We decided long ago that we don't want to track more than 0100, but we're discarding the rest between the filesystem and the index, rather than between the index and the tree. (This is weird of us, since we keep gid and uid in the index, as changedness heuristics, but don't keep permissions; of course, we'd have to apply umask to the index when we check it out to sync what we expect to be there with what has actually been created.)

I think that would be the only change needed to the index and index/working directory connection, although it might be necessary to support longer values for uid/gid/etc, since they'd be important data now.

Note that git only stores content, not incidental information. But a lot of information which is incidental in a source tree is content in /etc. This implies that /etc and working/linux-2.6 are fundamentally different sorts of things, because different aspects of them are content.

I'd suggest a new object type for a directory with permissions, ACLs, and so forth. It should probably use symbolic owner and group, too. My guess is that you'll want to use "commit"s, the new object type, and "blob"s. Everything that uses trees would need to have a version that uses the new type. But I think that you generally want different behavior anyway, so that's not a major issue.

	-Daniel
Previous: Nikolai WeibullNext: Kyle Moffett
Message 21 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.