mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager
synced 2024-10-14 20:18:39 +00:00
contrib/makerepo.sh: fix name for local cache of git repository
The $URL might already contain a ".git" suffix. Then $FULLNAME would end up having two ".git" extensions. Fix that.
This commit is contained in:
parent
135bc5dd1f
commit
4d53df2911
|
@ -319,16 +319,25 @@ MAKEREPO_GIT_IGNORE_LAST="makerepo.gitignore.last-$CURRENT_BRANCH"
|
|||
|
||||
get_local_mirror() {
|
||||
local URL="$1"
|
||||
local DIRNAME
|
||||
local FULLNAME
|
||||
|
||||
if [[ -z "$URL" ]]; then
|
||||
return
|
||||
fi
|
||||
|
||||
local DIRNAME="$(echo $URL.git | sed -e 's#^.*/\([^/]\+\)$#\1#' -e 's/\(.*\)\.git$/\1/')"
|
||||
local FULLNAME="$srcdir/.git/.makerepo-${DIRNAME}.git"
|
||||
|
||||
[[ -n "$NO_REMOTE" ]] && return
|
||||
|
||||
DIRNAME="${URL##*/}"
|
||||
DIRNAME="${DIRNAME%.git}"
|
||||
FULLNAME="$srcdir/.git/.makerepo-${DIRNAME}.git"
|
||||
|
||||
if [ ! -d "$FULLNAME" ] && [ -d "$FULLNAME.git" ]; then
|
||||
# due to a bug, old versions of the script might have created "*.git.git/" directories.
|
||||
# rename.
|
||||
mv "$FULLNAME.git" "$FULLNAME"
|
||||
fi
|
||||
|
||||
if [[ ! -d "$FULLNAME" ]]; then
|
||||
if [[ -f "$FULLNAME" ]]; then
|
||||
# create a file with name $FULLNAME, to suppress local mirroring
|
||||
|
|
Loading…
Reference in a new issue