index : devtools32 | |
Archlinux32 fork of devtools | gitolite user |
summaryrefslogtreecommitdiff |
author | Andreas Baumann <mail@andreasbaumann.cc> | 2024-04-21 10:18:55 +0200 |
---|---|---|
committer | Andreas Baumann <mail@andreasbaumann.cc> | 2024-04-21 10:18:55 +0200 |
commit | 2dc7a161a09518edae9e04a77fca569460d6a560 (patch) | |
tree | 5c893311826fc1ae7090352fb2f17a2d3d3a560e /src/lib/repo | |
parent | a1ca197bc99c2d5c2977630cc4c9dbfd5461d9c1 (diff) | |
parent | 05bea3e922aa7aec5cba3242d3f34b5c10fad24e (diff) |
-rw-r--r-- | src/lib/repo/configure.sh | 7 | ||||
-rw-r--r-- | src/lib/repo/switch.sh | 13 |
diff --git a/src/lib/repo/configure.sh b/src/lib/repo/configure.sh index b3c188c..0980fd1 100644 --- a/src/lib/repo/configure.sh +++ b/src/lib/repo/configure.sh @@ -207,9 +207,14 @@ pkgctl_repo_configure() { fi for path in "${paths[@]}"; do - if ! realpath=$(realpath -e "${path}"); then + # resolve symlink for basename + if ! realpath=$(realpath --canonicalize-existing -- "${path}"); then die "No such directory: ${path}" fi + # skip paths that aren't directories + if [[ ! -d "${realpath}" ]]; then + continue + fi pkgbase=$(basename "${realpath}") pkgbase=${pkgbase%.git} diff --git a/src/lib/repo/switch.sh b/src/lib/repo/switch.sh index f411ac2..d8ba9df 100644 --- a/src/lib/repo/switch.sh +++ b/src/lib/repo/switch.sh @@ -101,16 +101,21 @@ pkgctl_repo_switch() { fi for path in "${paths[@]}"; do - if ! realpath=$(realpath -e -- "${path}"); then + # resolve symlink for basename + if ! realpath=$(realpath --canonicalize-existing -- "${path}"); then die "No such directory: ${path}" fi - pkgbase=$(basename "${realpath}") - - if [[ ! -d "${path}/.git" ]]; then + # skip paths that are not directories + if [[ ! -d "${realpath}" ]]; then + continue + fi + # skip paths that are not git repositories + if [[ ! -d "${realpath}/.git" ]]; then error "Not a Git repository: ${path}" continue fi + pkgbase=$(basename "${realpath}") if ! git -C "${path}" checkout "${GIT_CHECKOUT_OPTIONS[@]}" "${GIT_REF}"; then die "Failed to switch ${pkgbase} to version ${VERSION}" fi |