From 18c61de3fcac6b0e9e114734dc05ca5d89872eda Mon Sep 17 00:00:00 2001 From: "Kyle J. McKay" Date: Thu, 25 Aug 2016 01:51:18 -0700 Subject: [PATCH] shlib.sh: add is_svn_mirror_url function Refactor the old is_svn_mirror function and make it call the new is_svn_mirror_url function. Signed-off-by: Kyle J. McKay --- shlib.sh | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/shlib.sh b/shlib.sh index b07087f..f42db5a 100644 --- a/shlib.sh +++ b/shlib.sh @@ -494,6 +494,13 @@ is_gfi_mirror_url() { return 1 } +# returns false for empty string +# returns true if the passed in url is a mirror using git-svn +is_svn_mirror_url() { + [ -n "$1" ] || return 1 + [ "$(get_url_mirror_type "$1" 2>/dev/null || :)" = "s" ] +} + # returns mirror url for gitweb.baseurl of git directory # (GIT_DIR) passed in as the argument (which defaults to "." if omitted) # will fail if the directory does not have .nofetch and gitweb.baseurl @@ -528,7 +535,8 @@ is_gfi_mirror() { # returns true if the passed in git dir (defaults to ".") is a mirror using git-svn is_svn_mirror() { - [ "$(get_mirror_type "$1" 2>/dev/null || :)" = "s" ] + _url="$(get_mirror_url "$@")" || return 1 + is_svn_mirror_url "$_url" } # A well-known UTF-8 locale is required for some of the fast-import providers -- 2.11.4.GIT