From 220e5120db5c5c3af570b8d98f6d3792959a6b55 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?AJ=20C=C3=B4t=C3=A9?= <57828010+anderewrey@users.noreply.github.com> Date: Tue, 7 Jul 2026 06:45:48 -0400 Subject: [PATCH] feat(scp): Code review --- bin/git-scp | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/bin/git-scp b/bin/git-scp index 8efcb86..995af57 100755 --- a/bin/git-scp +++ b/bin/git-scp @@ -125,12 +125,14 @@ function scp_and_stage esac fi + local status=0 + if [ -n "$list" ] then local _TMP=${0///} # shellcheck disable=SC2086 echo "$list" > "$_TMP" - if _sanitize $list + if [ "$dry_run" -eq 1 ] || _sanitize $list then _info "Pushing to $remote ($(git config "remote.$remote.url"))" if [ "$dry_run" -eq 1 ] @@ -140,6 +142,9 @@ function scp_and_stage rsync -rlDv --files-from="$_TMP" ./ "$(git config "remote.$remote.url")/" && git add --force $list fi + status=$? + else + status=1 fi rm "$_TMP" fi @@ -154,11 +159,17 @@ function scp_and_stage then echo "$deleted" else - ssh "$(git config "remote.$remote.url" | cut -d: -f1)" -t "rm $deleted" && - echo "$deleted" + if ssh "$(git config "remote.$remote.url" | cut -d: -f1)" -t "rm $deleted" + then + echo "$deleted" + else + status=1 + fi fi COLOR_RESET fi + + return "$status" } function reverse_scp() @@ -180,15 +191,17 @@ function reverse_scp() local _TMP=${0///} echo "$@" > "$_TMP" + local status=0 if [ "$verbose" -eq 1 ] then rsync -rlDvni --files-from="$_TMP" "$(git config "remote.$remote.url")/" ./ + status=$? fi if [ "$dry_run" -eq 1 ] then rm "$_TMP" - return 0 + return "$status" fi if [ "$interactive" -eq 1 ]