X-Git-Url: https://git.madduck.net/code/myrepos.git/blobdiff_plain/c9f5c2cb085b3cee31b9a85bbe9394d3b0942ee5..4eb2cd7eadf0f70bf0e88d2356bff037314885ff:/lib/gitless?ds=inline diff --git a/lib/gitless b/lib/gitless index 8781316..20c2e5e 100644 --- a/lib/gitless +++ b/lib/gitless @@ -21,7 +21,6 @@ # commands can be used, as long as the file server is available. lib = - gitless_checkout() { server="$1" remotebase="$2" @@ -29,13 +28,18 @@ lib = hostname="$(hostname)" if [ "$hostname" = "$server" ]; then git clone "$dir.git" "$dir" + cd "$dir" else if [ ! -d "$remotebase/$dir.$hostname" ]; then - git clone --no-checkout "$remotebase/$dir.git" "$remotebase/$dir.$hostname" + git clone --shared --no-checkout "$remotebase/$dir.git" "$remotebase/$dir.$hostname" fi - mkdir -p $dir - cd $dir - ln -sf $remotebase/$dir/.git - git checkout . + mkdir -p "$dir" + cd "$dir" + ln -sf "$remotebase/$dir.$hostname/.git" + git reset --hard fi + + # disable auto gc, because it breaks repo hard links, + # and is not smart to run over a networked filesystem + git config gc.auto 0 }