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

[Xen-devel] [OSSTEST PATCH 02/11] adhoc-revtuple-generator: Do not always reclone



Instead, try setting the `origin' remote's URL and fetching.  If that
fails it may be that the local repo is corrupted, so then we try
recloning.

Signed-off-by: Ian Jackson <Ian.Jackson@xxxxxxxxxxxxx>
---
 adhoc-revtuple-generator |   14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)

diff --git a/adhoc-revtuple-generator b/adhoc-revtuple-generator
index dbe4773..f94f189 100755
--- a/adhoc-revtuple-generator
+++ b/adhoc-revtuple-generator
@@ -99,9 +99,17 @@ sub git_generator ($) {
     my $treename= $tree->{Treename};
     my $eff_url = git_massage_url($tree->{Url});
     my $upcmd= <<END;
-        set -e; exec >&2
-        rm -rf $c{Repos}/$treename
-        git clone --bare $eff_url $c{Repos}/$treename
+        set -xe; exec >&2
+        if ! sh -xe <<ENDIFCOND
+            # the "set -e"-disarmament done by "if" leaks into ( ) !
+           cd $c{Repos}/$treename
+           git remote set-url origin $eff_url
+           git fetch -p origin
+ENDIFCOND
+       then
+            rm -rf $c{Repos}/$treename
+            git clone --bare $eff_url $c{Repos}/$treename
+       fi
 END
     print DEBUG "GIT-GEN UPCMD\n$upcmd\n";
     shellcmd($upcmd) if $doupdate;
-- 
1.7.10.4


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

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