{"thread":{"id":"28180","subject":"Site dependent repositories","startedAt":"2011-08-21T03:31:17Z","lastAt":"2011-08-21T16:14:30Z","messageCount":4,"participants":["Stewart A. Brown","Andrew Keller","Evan Shelhamer","Jens Lehmann"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"173949","messageId":"4E507C05.2090700@sbcglobal.net","threadId":"28180","inReplyTo":null,"subject":"Site dependent repositories","fromName":"Stewart A. Brown","fromEmail":"sabrown256@sbcglobal.net","sentAt":"2011-08-21T03:31:17Z","receivedAt":"2011-08-21T03:31:17Z","isPatch":false,"sender":{"key":"sabrown256@sbcglobal.net","avatar":null},"body":"\nI am wondering whether or not git has the functionality to handle\nmy situation.\n\nI have git repositories at multiple sites.  At each site the git repository\nhas site dependent sources.  Each repository is organised something\nlike:\n\ntop/a/local\n       b\n       c/d/extensions\n       e\n\nThe directories top, a, b, c, d, and e have sources that need to be\npushed or pulled between the repositories at all sites.  The directories\n'local' and 'extensions' have sources that must be managed within sites\nbut never pushed or pulled between sites.\n\nThe ignore mechanism will not suffice because the files in 'local' and\n'extensions' must be source managed.  I have looked a bit into\nsubmodules, filters, and hooks.  None of these jumps out as obvious, but\nthey are rich mechanisms with plenty of subtleties.\n\nDoes git have a way of letting me do this?\n\nStewart Brown\nsabrown256@gmail.com\n"},{"id":"173950","messageId":"AA0C484C-FD80-4C76-9E45-4BAE51B87ED7@kellerfarm.com","threadId":"28180","inReplyTo":"4E507C05.2090700@sbcglobal.net","subject":"Re: Site dependent repositories","fromName":"Andrew Keller","fromEmail":"andrew@kellerfarm.com","sentAt":"2011-08-21T04:21:16Z","receivedAt":"2011-08-21T04:21:16Z","isPatch":false,"sender":{"key":"andrew@kellerfarm.com","avatar":"https://avatars.githubusercontent.com/u/304204?v=4"},"body":"On Aug 20, 2011, at 11:31 PM, Stewart A. Brown wrote:\n\n> I have git repositories at multiple sites.  At each site the git repository\n> has site dependent sources.  Each repository is organised something\n> like:\n> \n> top/a/local\n>      b\n>      c/d/extensions\n>      e\n> \n> The directories top, a, b, c, d, and e have sources that need to be\n> pushed or pulled between the repositories at all sites.  The directories\n> 'local' and 'extensions' have sources that must be managed within sites\n> but never pushed or pulled between sites.\n> \n> The ignore mechanism will not suffice because the files in 'local' and\n> 'extensions' must be source managed.  I have looked a bit into\n> submodules, filters, and hooks.  None of these jumps out as obvious, but\n> they are rich mechanisms with plenty of subtleties.\n> \n> Does git have a way of letting me do this?\n\nNo.\n\nHave you considered using a sort of configuration switch?  Include all local and extension files for every site in the repository, and devise some sort of a switch that detects which site you're in, and creates a link to the correct subfolder.\n\nSo, for example, when you first clone the repository, top/a/local would contain:\n\nsite1/\nsite2/\nsite3/\n\nAnd so on.  Then, upon running a script of some sort (perhaps a make script), the site is detected (or inputted), and a symbolic link could be created to the correct folder.  At this point, top/a/local would contain:\n\nactive -> site2\nsite1/\nsite2/\nsite3/\n\nwhere 'active' is a symbolic link pointing to the correct folder.  This symbolic link would be a candidate for a .gitignore file.\n\nThis way, any change you make in one of the site-specific folders is still tracked in the repository.  Of course, this has the disadvantage that each site has access to the files of every site.  Depending on your situation, that might be a show stopper.\n\nHTH\n~ Andrew Keller\n"},{"id":"173951","messageId":"loom.20110821T074112-429@post.gmane.org","threadId":"28180","inReplyTo":"4E507C05.2090700@sbcglobal.net","subject":"Re: Site dependent repositories","fromName":"Evan Shelhamer","fromEmail":"shelhamer@imaginarynumber.net","sentAt":"2011-08-21T05:46:29Z","receivedAt":"2011-08-21T05:46:29Z","isPatch":false,"sender":{"key":"shelhamer@imaginarynumber.net","avatar":null},"body":"Have you considered ignoring 'local' and 'extensions' and making each their\nown repositories?\n\nA 'site' repository would contain the dir structure you described, and would\nhave a .gitignore to ignore 'local' and 'extensions'. As these are now ignored\nby git, you are free to create a git repo in each dir that will be independent\nof the 'site' repo.\n\nThis way you would be able to push/pull 'site' repos without 'local' and\n'extensions' being tracked or changed. However, you can still go into the\n'local' and 'extensions' dirs and work with the git repos established for\nthese directories.\n\nThis brings up the problem of keeping a given 'site' repo and its inner\n'local' and 'extensions' repos in sync, but you could do this by coordinating\npushs, pulls, and checkouts by a deploy script or something of that nature.\n"},{"id":"173961","messageId":"4E512EE6.60900@web.de","threadId":"28180","inReplyTo":"4E507C05.2090700@sbcglobal.net","subject":"Re: Site dependent repositories","fromName":"Jens Lehmann","fromEmail":"jens.lehmann@web.de","sentAt":"2011-08-21T16:14:30Z","receivedAt":"2011-08-21T16:14:30Z","isPatch":false,"sender":{"key":"jens.lehmann@web.de","avatar":"https://avatars.githubusercontent.com/u/135220?v=4"},"body":"Am 21.08.2011 05:31, schrieb Stewart A. Brown:\n> I am wondering whether or not git has the functionality to handle\n> my situation.\n> \n> I have git repositories at multiple sites.  At each site the git repository\n> has site dependent sources.  Each repository is organised something\n> like:\n> \n> top/a/local\n>       b\n>       c/d/extensions\n>       e\n> \n> The directories top, a, b, c, d, and e have sources that need to be\n> pushed or pulled between the repositories at all sites.  The directories\n> 'local' and 'extensions' have sources that must be managed within sites\n> but never pushed or pulled between sites.\n> \n> The ignore mechanism will not suffice because the files in 'local' and\n> 'extensions' must be source managed.  I have looked a bit into\n> submodules, filters, and hooks.  None of these jumps out as obvious, but\n> they are rich mechanisms with plenty of subtleties.\n> \n> Does git have a way of letting me do this?\n\nIt would work if you could set it up like this:\n\ntop/shared\n    non-shared-stuff\n\nwhere \"top\" is your git repository, \"shared\" is a submodule you put all the\nnon-site specific stuff in and have that version controlled together with\nyour local stuff. If you can't rearrange your directory tree you might be\nable to use symlinks to achieve that layout:\n\ntop/a/local -> ../local\n      b\n      c/d/extensions -> ../../extensions\n      e\ntop/extension\ntop/local\n\nwhere \"a\" is your shared submodule that lives together with \"extensions\" and\n\"local\" in the top level repo.\n"}]}