I often want to take a base tree, which I keep tracking some remote head, and make a local working tree that starts from it. This makes "git ln -c <dest>" give you a tree that you can just start working in and then diff against the head you'd started from and send off.
Signed-Off-By: Daniel Barkalow <[EMAIL PROTECTED]> Index: gitlntree.sh =================================================================== --- b068d3ec7c00cfe4a1f14a898f61c4807cd5bc8b/gitlntree.sh (mode:100755 sha1:17c4966ea64aeced96ae4f1b00f3775c1904b0f1) +++ 0877e1b9b70a4305959b7f65ace4044e4ae0afdb/gitlntree.sh (mode:100755 sha1:84cbf0492996f1139b992147b4f53bc14342e3f2) @@ -7,11 +7,14 @@ # same objects database as the current one. It also shares the # branches and tags information. # -# The new directory is completely pristine - there's not even -# a directory cache there yet. -# # Takes the new directory name. +if [ "$1" = "-c" ] +then + clone=yes + shift 1 +fi + destdir=$1 die () { @@ -32,3 +35,12 @@ ln -s $srcdir/.git/objects $dgitdir/objects ln -s $srcdir/.git/remotes $dgitdir/remotes ln -s $srcdir/.git/tags $dgitdir/tags + +if [ "$clone" != "" ] +then + cp $srcdir/.git/HEAD $dgitdir/HEAD + cd $destdir + read-tree $(tree-id) + checkout-cache -a + update-cache --refresh +fi - To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html