git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Site dependent repositories
@ 2011-08-21  3:31 Stewart A. Brown
  2011-08-21  4:21 ` Andrew Keller
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Stewart A. Brown @ 2011-08-21  3:31 UTC (permalink / raw)
  To: git


I am wondering whether or not git has the functionality to handle
my situation.

I have git repositories at multiple sites.  At each site the git repository
has site dependent sources.  Each repository is organised something
like:

top/a/local
       b
       c/d/extensions
       e

The directories top, a, b, c, d, and e have sources that need to be
pushed or pulled between the repositories at all sites.  The directories
'local' and 'extensions' have sources that must be managed within sites
but never pushed or pulled between sites.

The ignore mechanism will not suffice because the files in 'local' and
'extensions' must be source managed.  I have looked a bit into
submodules, filters, and hooks.  None of these jumps out as obvious, but
they are rich mechanisms with plenty of subtleties.

Does git have a way of letting me do this?

Stewart Brown
sabrown256@gmail.com

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Site dependent repositories
  2011-08-21  3:31 Site dependent repositories Stewart A. Brown
@ 2011-08-21  4:21 ` Andrew Keller
  2011-08-21  5:46 ` Evan Shelhamer
  2011-08-21 16:14 ` Jens Lehmann
  2 siblings, 0 replies; 4+ messages in thread
From: Andrew Keller @ 2011-08-21  4:21 UTC (permalink / raw)
  To: Git List

On Aug 20, 2011, at 11:31 PM, Stewart A. Brown wrote:

> I have git repositories at multiple sites.  At each site the git repository
> has site dependent sources.  Each repository is organised something
> like:
> 
> top/a/local
>      b
>      c/d/extensions
>      e
> 
> The directories top, a, b, c, d, and e have sources that need to be
> pushed or pulled between the repositories at all sites.  The directories
> 'local' and 'extensions' have sources that must be managed within sites
> but never pushed or pulled between sites.
> 
> The ignore mechanism will not suffice because the files in 'local' and
> 'extensions' must be source managed.  I have looked a bit into
> submodules, filters, and hooks.  None of these jumps out as obvious, but
> they are rich mechanisms with plenty of subtleties.
> 
> Does git have a way of letting me do this?

No.

Have 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.

So, for example, when you first clone the repository, top/a/local would contain:

site1/
site2/
site3/

And 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:

active -> site2
site1/
site2/
site3/

where 'active' is a symbolic link pointing to the correct folder.  This symbolic link would be a candidate for a .gitignore file.

This 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.

HTH
~ Andrew Keller

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Site dependent repositories
  2011-08-21  3:31 Site dependent repositories Stewart A. Brown
  2011-08-21  4:21 ` Andrew Keller
@ 2011-08-21  5:46 ` Evan Shelhamer
  2011-08-21 16:14 ` Jens Lehmann
  2 siblings, 0 replies; 4+ messages in thread
From: Evan Shelhamer @ 2011-08-21  5:46 UTC (permalink / raw)
  To: git

Have you considered ignoring 'local' and 'extensions' and making each their
own repositories?

A 'site' repository would contain the dir structure you described, and would
have a .gitignore to ignore 'local' and 'extensions'. As these are now ignored
by git, you are free to create a git repo in each dir that will be independent
of the 'site' repo.

This way you would be able to push/pull 'site' repos without 'local' and
'extensions' being tracked or changed. However, you can still go into the
'local' and 'extensions' dirs and work with the git repos established for
these directories.

This brings up the problem of keeping a given 'site' repo and its inner
'local' and 'extensions' repos in sync, but you could do this by coordinating
pushs, pulls, and checkouts by a deploy script or something of that nature.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Site dependent repositories
  2011-08-21  3:31 Site dependent repositories Stewart A. Brown
  2011-08-21  4:21 ` Andrew Keller
  2011-08-21  5:46 ` Evan Shelhamer
@ 2011-08-21 16:14 ` Jens Lehmann
  2 siblings, 0 replies; 4+ messages in thread
From: Jens Lehmann @ 2011-08-21 16:14 UTC (permalink / raw)
  To: sabrown256; +Cc: Stewart A. Brown, git

Am 21.08.2011 05:31, schrieb Stewart A. Brown:
> I am wondering whether or not git has the functionality to handle
> my situation.
> 
> I have git repositories at multiple sites.  At each site the git repository
> has site dependent sources.  Each repository is organised something
> like:
> 
> top/a/local
>       b
>       c/d/extensions
>       e
> 
> The directories top, a, b, c, d, and e have sources that need to be
> pushed or pulled between the repositories at all sites.  The directories
> 'local' and 'extensions' have sources that must be managed within sites
> but never pushed or pulled between sites.
> 
> The ignore mechanism will not suffice because the files in 'local' and
> 'extensions' must be source managed.  I have looked a bit into
> submodules, filters, and hooks.  None of these jumps out as obvious, but
> they are rich mechanisms with plenty of subtleties.
> 
> Does git have a way of letting me do this?

It would work if you could set it up like this:

top/shared
    non-shared-stuff

where "top" is your git repository, "shared" is a submodule you put all the
non-site specific stuff in and have that version controlled together with
your local stuff. If you can't rearrange your directory tree you might be
able to use symlinks to achieve that layout:

top/a/local -> ../local
      b
      c/d/extensions -> ../../extensions
      e
top/extension
top/local

where "a" is your shared submodule that lives together with "extensions" and
"local" in the top level repo.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2011-08-21 16:14 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-08-21  3:31 Site dependent repositories Stewart A. Brown
2011-08-21  4:21 ` Andrew Keller
2011-08-21  5:46 ` Evan Shelhamer
2011-08-21 16:14 ` Jens Lehmann

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).