[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] [OSSTEST PATCH 5/7] Optimize git clone - use --depth=1



Do not clone the whole history to save time, disk space and bandwidth.
This reduce (on my machine) Linux clone from over half an hour to few
minutes.

Signed-off-by: Marek Marczykowski-Górecki <marmarek@xxxxxxxxxxxxxxxxxxxxxx>
---
This should be fine, unless this function is also used when preparing
for bisection. Is it?
---
 Osstest/TestSupport.pm | 18 +++++++++++-------
 1 file changed, 11 insertions(+), 7 deletions(-)

diff --git a/Osstest/TestSupport.pm b/Osstest/TestSupport.pm
index 9515c9b..e51ffc7 100644
--- a/Osstest/TestSupport.pm
+++ b/Osstest/TestSupport.pm
@@ -1492,15 +1492,19 @@ END
 END
     } elsif ($vcs eq 'git') {
 
-        target_cmd_build($ho, $timeout, $builddir, <<END.
-            $rm
-            git clone '$tree' $subdir
-            cd $subdir
+        if (length($r{"revision_$which"})) {
+            target_cmd_build($ho, $timeout, $builddir, <<END);
+                $rm
+                git clone --depth=1 -b '$r{"revision_$which"}' '$tree' $subdir
+                cd $subdir
 END
-                         (length($r{"revision_$which"}) ? <<END : ''));
-           git checkout '$r{"revision_$which"}'
-           git clean -xdf
+        } else {
+            target_cmd_build($ho, $timeout, $builddir, <<END);
+                $rm
+                git clone --depth=1 '$tree' $subdir
+                cd $subdir
 END
+        }
     } else {
         die "$vcs $which $tree ?";
     }
-- 
git-series 0.9.1

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.