aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormerakor <cem@ckyln.com>2021-07-03 08:35:42 +0000
committermerakor <cem@ckyln.com>2021-07-03 08:35:42 +0000
commit6dfa1177978a7a83e1d2b935f8a043c8fb8fb653 (patch)
tree20fb53d80bdacae32da93e3a5bf569f94f84550a
parenta1ea353e62662905b91b438bdf76b77610ae09d5 (diff)
downloadcpt-6dfa1177978a7a83e1d2b935f8a043c8fb8fb653.tar.gz
pkg_vcs_pull_git: fetch submodules even if the repository is local
FossilOrigin-Name: 095dc0bf02a3988aa78a879ad633f712395fd8213e92edb41f13cbcf3b28b61d
-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
}