Skip to content

Commit 49a52b4

Browse files
committed
update
1 parent b3142ca commit 49a52b4

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

libraries/util.bash

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -713,6 +713,24 @@ function unzipRemoteFile()
713713
fi
714714
}
715715

716+
#################
717+
# GIT UTILITIES #
718+
#################
719+
720+
function getGitRepositoryNameFromCloneURL()
721+
{
722+
local -r cloneURL="${1}"
723+
724+
checkNonEmptyString "${cloneURL}" 'undefined clone url'
725+
726+
if [[ "$(grep -F -o '@' <<< "${cloneURL}")" != '' ]]
727+
then
728+
awk -F '/' '{ print $2 }' <<< "${cloneURL}" | cut -d '.' -f 1
729+
else
730+
awk -F '/' '{ print $5 }' <<< "${cloneURL}" | cut -d '.' -f 1
731+
fi
732+
}
733+
716734
####################
717735
# NUMBER UTILITIES #
718736
####################

0 commit comments

Comments
 (0)