diff options
author | merakor <cem@ckyln.com> | 2020-05-28 00:13:43 +0000 |
---|---|---|
committer | merakor <cem@ckyln.com> | 2020-05-28 00:13:43 +0000 |
commit | f216852698bb621ffa65a4a705b83abb4af9a89b (patch) | |
tree | 531b896c9f38ccf559d4c58bd82dd544dbe7adbe /kiss | |
parent | 16f53ebb021c39056857efcf9cd326562ae12dde (diff) | |
download | cpt-f216852698bb621ffa65a4a705b83abb4af9a89b.tar.gz |
kiss: adapt submodule pulling
FossilOrigin-Name: c63983d8bd92cd11dc1a4ea3666c22023d088d7fc2f5b00ef0c63bce9bd40376
Diffstat (limited to 'kiss')
-rwxr-xr-x | kiss | 22 |
1 files changed, 9 insertions, 13 deletions
@@ -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 } |