diff options
author | Leah Rowe <leah@libreboot.org> | 2025-10-16 14:22:06 +0100 |
---|---|---|
committer | Leah Rowe <leah@libreboot.org> | 2025-10-16 14:22:06 +0100 |
commit | d84a556bf084b4622cf389847ee3f888bb4dbbe5 (patch) | |
tree | 292c50703969c0e08a8d0ae19c3119de5f57bf4d | |
parent | b333ddfe73ce986f1b79f276bbac2c84a11d8461 (diff) |
get.sh: use the same directory map as --mirror
Don't hardcode the cache directory, and don't store
remotes anymore. This change retains compatibility
in practice, with the older directory location, because
it's extremely unlikely that newly generated locations
would conflict with old ones.
With this new change, non-mirror git clone caches are
now done twice; one directory per remote, rather than
one directory with two remotes.
This is just inherently much more reliable.
Signed-off-by: Leah Rowe <leah@libreboot.org>
-rw-r--r-- | include/get.sh | 23 |
1 files changed, 7 insertions, 16 deletions
diff --git a/include/get.sh b/include/get.sh index c463bbc5..20ee4fe5 100644 --- a/include/get.sh +++ b/include/get.sh @@ -203,19 +203,16 @@ try_fetch() try_fetch_git() { - if [ "$XBMK_CACHE_MIRROR" = "y" ]; then - # 1st argument $1 is the current git remote being tried, - # let's say it was https://foo.example.com/repo, then cached - # directories becomes cache/mirror/foo.example.com/repo + # 1st argument $1 is the current git remote being tried, + # let's say it was https://foo.example.com/repo, then cached + # directories becomes cache/mirror/foo.example.com/repo - cached="mirror/${1#*://}" + if [ "$XBMK_CACHE_MIRROR" = "y" ]; then + cached="mirror" else - # always the main repo as basis for naming, - # in case the backup has another name - - cached="clone/${3##*/}" - cached="${cached%.git}" + cached="clone" fi + cached="$cached/${1#*://}" cached="$XBMK_CACHE/$cached" x_ xbmkdir "${5%/*}" "${cached%/*}" @@ -327,12 +324,6 @@ try_git() ( x_ git -C "$gitdest" fetch ) || :; : ( x_ git -C "$gitdest" update-server-info ) || :; : else - ( x_ git -C "$gitdest" remote remove main ) || : - ( x_ git -C "$gitdest" remote remove backup ) || : - - x_ git -C "$gitdest" remote add main "$4" - x_ git -C "$gitdest" remote add backup "$5" - ( x_ git -C "$gitdest" pull --all ) || :; : fi } |