aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/cpt-lib.in44
1 files changed, 26 insertions, 18 deletions
diff --git a/src/cpt-lib.in b/src/cpt-lib.in
index b4fb79d..ebb1bc3 100644
--- a/src/cpt-lib.in
+++ b/src/cpt-lib.in
@@ -1656,26 +1656,34 @@ pkg_vcs_pull_fossil() {
pkg_vcs_pull_git() {
# Pull function for Git.
- [ "$(git remote 2>/dev/null)" ] || {
- log "$repo" " "
- printf '%s\n' "No remote, skipping."
- return 0
- }
-
- # Display a message if signing is enabled for this repository.
- case $(git config merge.verifySignatures) in
- true) log "$PWD" "[signed] " ;;
- *) log "$PWD" " " ;;
- esac
+ if [ "$(git remote 2>/dev/null)" ]; then
+ # Display a message if signing is enabled for this repository.
+ case $(git config merge.verifySignatures) in
+ true) log "$PWD" "[signed] " ;;
+ *) log "$PWD" " " ;;
+ esac
- # Ensure we have proper permissions to do the pull operation.
- if [ -w "$PWD" ] && [ "$uid" != 0 ]; then
- git fetch
- git merge
- git submodule update --remote --init -f
+ # Ensure we have proper permissions to do the pull operation.
+ if [ -w "$PWD" ] && [ "$uid" != 0 ]; then
+ git fetch
+ git merge
+ git submodule update --remote --init -f
+ else
+ pkg_vcs_as_root \
+ "git fetch && git merge && git submodule update --remote --init -f"
+ fi
else
- pkg_vcs_as_root \
- "git fetch && git merge && git submodule update --remote --init -f"
+ log "$PWD" " "
+ # Skip if there are no submodules
+ [ -f .gitmodules ] || {
+ out "No remote, skipping."
+ return 0
+ }
+ if [ -w "$PWD" ] && [ "$uid" != 0 ]; then
+ git submodule update --remote --init -f
+ else
+ pkg_vcs_as_root "git submodule update --remote --init -f"
+ fi
fi
}