checkout-cache -f: a better way?
- From
- Jeff Garzik <jgarzik@pobox.com>
- Date
- May 20, 2005, 21:05 UTC
- Message-ID
- <428E5102.60003@pobox.com>
Being a weirdo, I don't use cogito for kernel development, just git itself. I store branches in .git/refs/heads/ per the defacto standard, and use the attached script to switch the working directory from one branch to another.
Problem is, 'git-checkout-cache -q -f -a' really pounds the disk, and takes quite a while.
Is there any way to avoid -f, while ensuring that the working directory truly represents the new branch?
BitKeeper has a secret checkout arg '-S', which will leave files untouched if the mtime/size information is unchanged.
Jeff
#!/bin/sh
if [ "x$1" != "x" ] then if [ "$1" == "master" ] then ( cd .git && rm -f HEAD && ln -s refs/heads/master HEAD ) else if [ ! -f .git/refs/heads/$1 ] then echo Branch $1 not found. exit 1 fi
( cd .git && rm -f HEAD && ln -s refs/heads/$1 HEAD ) fi fi
git-read-tree $(cat .git/HEAD) && \ git-checkout-cache -q -f -a && \ git-update-cache --refresh