From 08d397fb0dd26f9f76871763b4347f0f648efb9b Mon Sep 17 00:00:00 2001 From: zador-blood-stained Date: Mon, 9 Jan 2017 18:10:39 +0300 Subject: [PATCH] Improve fetch_from_repo compatibility with older git versions --- general.sh | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/general.sh b/general.sh index 4bcf4812d5..fa72a343d6 100644 --- a/general.sh +++ b/general.sh @@ -197,9 +197,11 @@ fetch_from_repo() cd $SOURCES/$workdir # check if existing remote URL for the repo or branch does not match current one - if [[ $(git rev-parse --is-inside-work-tree 2>/dev/null) == true && \ + # may not be supported by older git versions + local current_url=$(git remote get-url origin 2>/dev/null) + if [[ -n $current_url && $(git rev-parse --is-inside-work-tree 2>/dev/null) == true && \ $(git rev-parse --show-toplevel) == $(pwd) && \ - $(git remote get-url origin) != $url ]]; then + $current_url != $url ]]; then display_alert "Remote URL does not match, removing existing local copy" rm -rf .git * fi