Roland0 wrote:
> For git, one can use git rm -r <directory> after the initial checkout.
> Combined with gitignore, this makes sure one doesn't get the binaries
> with a pull.
I have been experimenting, and I think I have a better method for those
people using git instead of svn. It uses the sparse checkout feature of
git to avoid blowing up the binaries, and the exclude feature to allow
for self-built binaries to be included but not tracked, and of course
the shallow clone feature to condense the git db.
When using this method, you have a couple options: clone and clean; or
init, configure, and pull. If you clone and clean, you will expand the
binaries when you first do the clone, so you'll need 300MB or so of
extra space which you will recover after setting up the sparse checkout
and then re-checking out. The other option involves initializing an
empty repository, setting the remote to the github repo, setting up
sparse checkout, and pulling. No extra space is needed for that method,
just the ~170MB for the source files and the git db. By default, the
clone method will create a local branch with the same name as the remote
branch specified, while the init method will use master as the local
branch, git branch -m can be used to make the local branch name whatever
you want.
The sparse checkout feature is enabled using "git config
core.sparsecheckout true". It uses the file .git/info/sparse-checkout
to control what portions of the git db to expand into the working
directory. The file follows the same conventions as a .gitignore (or
.git/info/exclude) file, although the sense is reversed (files that
match are included rather than excluded). If you make changes to the
sparse-checkout file, you will need to re-checkout your current branch
for the changes to take effect. It will tell you that you are already
on the branch, but it will change the working directory anyway.
The exclude feature is enabled by default and just requires the
.git/info/exclude file to be modified. Files that match in it are
excluded from tracking. Changes will show up (in git status) for
untracked files immediately, for files that are already being tracked
(through git add or git commit -a), you'll need to use git rm to make
them untracked.
The shallow clone feature is done by including --depth=1 either on the
git clone or the initial git pull command. Once performed, git manages
the shallow clone using the file .git/shallow, which does not exist on
full-weight clones. So, subsequent git pulls should not need any
options (possibly git version dependent).
Here are scripts for both methods (included git branch -m on the init
method so that the local branch on it ends up the same as the clone):
there should not be a slimserver directory under your current directory
if you run these
clone and clean:
Code:
--------------------
#! /bin/bash
SLIMBRANCH=public/7.9
git clone --depth=1 -b $SLIMBRANCH git://github.com/Logitech/slimserver.git
cd slimserver
git config core.sparsecheckout true
cat <<EOF>.git/info/sparse-checkout
/*
!/Bin
!/CPAN/arch
EOF
cat <<EOF>>.git/info/exclude
/Bin/*
/CPAN/arch/*
EOF
git checkout $SLIMBRANCH
--------------------
init, config, pull
Code:
--------------------
#! /bin/bash
SLIMBRANCH=public/7.9
mkdir slimserver
cd slimserver
git init
git remote add -t $SLIMBRANCH origin git://github.com/Logitech/slimserver.git
git config core.sparsecheckout true
cat <<EOF>.git/info/sparse-checkout
/*
!/Bin
!/CPAN/arch
EOF
cat <<EOF>>.git/info/exclude
/Bin/*
/CPAN/arch/*
EOF
git pull --depth=1
git branch -m master $SLIMBRANCH
--------------------
If a particular architecture (for example x86_64 Linux on perl 5.14) is
desired to be included, then lines can be added to the sparse-checkout
and exclude files (note that if a parent directory is ignored, you can't
unignore things below that directory, so you need to unignore the parent
directory, then ignore everything in it, then unignore what you really
want, which complicates the exclude file for the CPAN case due to nested
directories)
Here are the example files, with comments
.git/info/sparse-checkout
Code:
--------------------
# checkout everything
/*
# but not the Bin directory
!/Bin
# but do checkout the Bin/x86_64-linux directory
/Bin/x86_64-linux
# and also not the CPAN/arch directory
!/CPAN/arch
# but do checkout the CPAN/arch/5.14/x86_64-linux-thread-multi directory
/CPAN/arch/5.14/x86_64-linux-thread-multi
--------------------
.git/info/exclude
Code:
--------------------
# ignore everything in the Bin directory
/Bin/*
# but don't ignore the Bin/x86_64-linux directory
!/Bin/x86_64-linux
# ignore everything in the CPAN/arch directory
/CPAN/arch/*
# but don't ignore the CPAN/arch/5.14 directory
!/CPAN/arch/5.14
# but ignore everything in the CPAN/arch/5.14 directory
/CPAN/arch/5.14/*
# but don't ignore the CPAN/arch/5.14/x86_64-linux-thread-multi directory
!/CPAN/arch/5.14/x86_64-linux-thread-multi
--------------------
------------------------------------------------------------------------
Grotus's Profile: http://forums.slimdevices.com/member.php?userid=887
View this thread: http://forums.slimdevices.com/showthread.php?t=99667
_______________________________________________
beta mailing list
[email protected]
http://lists.slimdevices.com/mailman/listinfo/beta