git and pseudo-install.pl

Obsolete! - Please refer to GitBasedInstall for current documentation.

Notes

  • When you try to pseudo-install a missing module, pseudo-install tries to clone it from the list of configured git repositories (default: 'pseudo-install' key in $HOME/.buildcontrib), trying each in turn until one of the repos is found to have the missing module, then
    • if there's a svn entry, it will try to wire up the cloned repo for use with git-svn
    • run pseudo-install.pl -G to generate the default config
    • default config clones from github.com/foswiki/<module>.git and tries to wire it up to svn.foswiki.org
    • git's 'master' branch is svn's trunk
  • When you pseudo-install a module, pseudo-install maintains a .gitignore file in the root of each module directory (if there are derived files for that module). It tries to merge with an existing .gitignore in that location, but is NOT aware of any other .gitignore files, and also igores any .git/info/exclude file's rules (to be fixed, one day)
  • Don't forget to use git clean -x modifier to clean ignored files, Eg. git clean -fdx

  • TODO: Re-write this into developer documentation smile
  • TODO: Make pseudo-install merge wildcards/patterns from the various .gitignore /exclude sources that the standard git command works with

Submodules

Setting up the super-module

  • cd /path/to/foswiki (should be parent of /path/to/foswiki/core)
  • git init
  • git remote add origin /path/to/foswiki
  • find . -maxdepth 1 -type d -exec git submodule add {} \;
  • git commit -a - initial commit
  • git submodule foreach <do stuff>
  • git submodule foreach '<do stuff> || :' (do stuff but don't abort if the command returns non-zero exit status)

Common actions

  • Clean only ignored/generated files:
    • git submodule foreach git clean -fdX
  • Clean everything (including removal of ignored/generated files):
    • git submodule foreach git clean -fdx
  • Ignore changes to permissions
    • git submodule foreach git config core.filemode false
  • Reset all files:
    • git submodule foreach git reset --hard
  • Update the checkout to latest from svn:
    • git submodule foreach git svn rebase, or
    • git submodule foreach 'git svn rebase || :' (tries to rebase all modules instead of aborting at the first one which fails from e.g. uncommitted changes)
  • Checkout Release01x01 branch (on modules that have it):
    • git submodule foreach 'git checkout Release01x01 || :'
  • Show which branch each module has checked out, and if modified/updated:
    • git submodule status
  • Show list of commits against each module relative to the version the git super-project is pointing at:
    • git submodule summary

Alternatives to submodules

git-subtree example

Splitting SvenDowideit 's work on core from his 'fat' git repo into a dedicated core submodule:

git clone git@github.com:/SvenDowideit/foswiki.git
cd foswiki
git subtree split --prefix core --branch store2
git remote add csirac2 git@github.com:/csirac2/core.git
git push csirac2 store2:store2
Topic revision: r8 - 09 Jan 2017, GeorgeClark
The copyright of the content on this website is held by the contributing authors, except where stated elsewhere. See Copyright Statement. Creative Commons License    Legal Imprint    Privacy Policy