From 6dfa1177978a7a83e1d2b935f8a043c8fb8fb653 Mon Sep 17 00:00:00 2001 From: merakor Date: Sat, 3 Jul 2021 08:35:42 +0000 Subject: pkg_vcs_pull_git: fetch submodules even if the repository is local FossilOrigin-Name: 095dc0bf02a3988aa78a879ad633f712395fd8213e92edb41f13cbcf3b28b61d --- src/cpt-lib.in | 44 ++++++++++++++++++++++++++------------------ 1 file 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 } -- cgit v1.2.3