|
Lines 368-373
_git-r3_is_local_repo() {
Link Here
|
| 368 |
[[ ${uri} == file://* || ${uri} == /* ]] |
368 |
[[ ${uri} == file://* || ${uri} == /* ]] |
| 369 |
} |
369 |
} |
| 370 |
|
370 |
|
|
|
371 |
# @FUNCTION: _git-r3_canonize_url |
| 372 |
# @USAGE: <uri> |
| 373 |
# @INTERNAL |
| 374 |
# @DESCRIPTION: |
| 375 |
# Removes ../ and ./ from paths so that the location pointed at |
| 376 |
# remains the same. |
| 377 |
_git-r3_canonize_url() { |
| 378 |
new="$1" |
| 379 |
while [[ "$old" != "$new" ]]; do |
| 380 |
old="$new" |
| 381 |
new=$(echo "$old" | sed 's!/\([^/][^/]*\)/\.\.!! |
| 382 |
s!//\./!/!') |
| 383 |
done |
| 384 |
echo "$new" |
| 385 |
} |
| 386 |
|
| 371 |
# @FUNCTION: git-r3_fetch |
387 |
# @FUNCTION: git-r3_fetch |
| 372 |
# @USAGE: [<repo-uri> [<remote-ref> [<local-id>]]] |
388 |
# @USAGE: [<repo-uri> [<remote-ref> [<local-id>]]] |
| 373 |
# @DESCRIPTION: |
389 |
# @DESCRIPTION: |
|
Lines 534-542
git-r3_fetch() {
Link Here
|
| 534 |
die "Unable to get commit id for submodule ${subname}" |
550 |
die "Unable to get commit id for submodule ${subname}" |
| 535 |
fi |
551 |
fi |
| 536 |
if [[ ${url} == ./* || ${url} == ../* ]]; then |
552 |
if [[ ${url} == ./* || ${url} == ../* ]]; then |
| 537 |
local subrepos=( "${repos[@]/%//${url}}" ) |
553 |
local subrepos=( ) |
|
|
554 |
for i in "${repos[@]/%/\/${url}}"; do |
| 555 |
subrepos=("${subrepos[@]}" $(_git-r3_canonize_url "$i")) |
| 556 |
done |
| 538 |
else |
557 |
else |
| 539 |
local subrepos=( "${url}" ) |
558 |
subrepos=("${url}") |
| 540 |
fi |
559 |
fi |
| 541 |
|
560 |
|
| 542 |
git-r3_fetch "${subrepos[*]}" "${commit}" "${local_id}/${subname}" |
561 |
git-r3_fetch "${subrepos[*]}" "${commit}" "${local_id}/${subname}" |
|
Lines 655-661
git-r3_checkout() {
Link Here
|
| 655 |
local path=${submodules[2]} |
674 |
local path=${submodules[2]} |
| 656 |
|
675 |
|
| 657 |
if [[ ${url} == ./* || ${url} == ../* ]]; then |
676 |
if [[ ${url} == ./* || ${url} == ../* ]]; then |
| 658 |
url=${repos[0]%%/}/${url} |
677 |
url="$(_git-r3_canonize_url "${repos[0]%%/}/${url}")" |
| 659 |
fi |
678 |
fi |
| 660 |
|
679 |
|
| 661 |
git-r3_checkout "${url}" "${GIT_WORK_TREE}/${path}" \ |
680 |
git-r3_checkout "${url}" "${GIT_WORK_TREE}/${path}" \ |