]> git.rm.cloudns.org Git - xonotic/xonotic.git/commitdiff
actually use hardlinks if possible
authorRudolf Polzer <divVerent@xonotic.org>
Fri, 27 May 2011 07:51:52 +0000 (09:51 +0200)
committerRudolf Polzer <divVerent@xonotic.org>
Fri, 27 May 2011 07:51:52 +0000 (09:51 +0200)
all

diff --git a/all b/all
index d3e42d3503d0f7f973be90ad7739880fcf3389fb..a17f2ac9127d2490bbb2d4993d5057594b05aae3 100755 (executable)
--- 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