aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormerakor <cem@ckyln.com>2020-05-28 00:13:43 +0000
committermerakor <cem@ckyln.com>2020-05-28 00:13:43 +0000
commitf216852698bb621ffa65a4a705b83abb4af9a89b (patch)
tree531b896c9f38ccf559d4c58bd82dd544dbe7adbe
parent16f53ebb021c39056857efcf9cd326562ae12dde (diff)
downloadcpt-f216852698bb621ffa65a4a705b83abb4af9a89b.tar.gz
kiss: adapt submodule pulling
FossilOrigin-Name: c63983d8bd92cd11dc1a4ea3666c22023d088d7fc2f5b00ef0c63bce9bd40376
-rwxr-xr-xkiss22
1 files changed, 9 insertions, 13 deletions
diff --git a/kiss b/kiss
index d152cf4..0079437 100755
--- a/kiss
+++ b/kiss
@@ -1236,10 +1236,7 @@ pkg_fetch() {
if [ -w "$PWD" ] && [ "$uid" != 0 ]; then
git fetch
git merge
- ! [ -e .gitmodules ] || {
- git submodule init
- git submodule update
- }
+ git submodule update --remote --init -f
else
[ "$uid" = 0 ] || log "$PWD" "Need root to update"
@@ -1259,15 +1256,14 @@ pkg_fetch() {
[ "$user" = root ] ||
log "Dropping permissions to $user for pull"
- case $su in
- su) "$su" -c "git fetch && git merge && { ! [ -e .gitmodules ] || { git submodule init ; git submodule update ;} ;}" "$user" ;;
- *) "$su" -u "$user" git fetch
- "$su" -u "$user" git merge
- ! [ -e .gitmodules ] || {
- "$su" -u "$user" git submodule init
- "$su" -u "$user" git submodule update
- }
- esac
+ git_cmd="git fetch && git merge && git submodule update --remote --init -f"
+ case $su in *su) git_cmd="'$git_cmd'"; esac
+
+ # Spawn a subshell to run multiple commands as
+ # root at once. This makes things easier on users
+ # who aren't using persist/timestamps for auth
+ # caching.
+ user=$user as_root sh -c "$git_cmd"
)
fi
}