From: Rudolf Polzer Date: Fri, 27 May 2011 07:51:52 +0000 (+0200) Subject: actually use hardlinks if possible X-Git-Tag: xonotic-v0.5.0~84 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=0c8b902aec765f95c39872a66c44edae70d30ece;p=xonotic%2Fxonotic.git actually use hardlinks if possible --- diff --git a/all b/all index d3e42d35..a17f2ac9 100755 --- a/all +++ b/all @@ -295,13 +295,27 @@ case "$cmd" in { release_src=$1; shift release_dst=$1; shift - { - verbose cd "$release_src" - verbose git archive --format=tar HEAD -- "$@" - } | { - verbose cd "$release_dst" - verbose tar xvf - - } + # try to create a hardlink + if ln -f "$release_src/.git/HEAD" "$release_dst/.hardlink-test"; then + rm -f "$release_dst/.hardlink-test" + { + verbose cd "$release_src" + git ls-files HEAD -- "$@" + } | { + while IFS= read -r F; do + case "$F" in */*) mkdir -p "$release_dst/${F%/}" ;; esac + verbose ln -f "$release_src/$F" "$release_dst/$F" + done + } + else + { + verbose cd "$release_src" + verbose git archive --format=tar HEAD -- "$@" + } | { + verbose cd "$release_dst" + verbose tar xvf - + } + fi } ;; esac