From bbec7dd540343dacc352593688070581d5f17273 Mon Sep 17 00:00:00 2001 From: Tim Byrne Date: Wed, 30 Mar 2016 03:31:21 -0500 Subject: [PATCH] Handle errors during `git fetch origin` --- yadm | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/yadm b/yadm index 559d8413..dcecaefc 100755 --- a/yadm +++ b/yadm @@ -148,7 +148,11 @@ function clone() { #; fetch / merge (and possibly fallback to reset) debug "Doing an initial fetch of the origin" - git fetch origin + git fetch origin || { + debug "Removing repo after failed clone" + rm -rf "$YADM_REPO" + error_out "Unable to fetch origin $1" + } debug "Doing an initial merge of origin/master" git merge origin/master || { debug "Merge failed, doing a reset."