From ab41b2f851c79a51eb8fc22d7fd8ac60b802b964 Mon Sep 17 00:00:00 2001 From: Andrew Cady Date: Sun, 9 Dec 2018 03:53:10 -0500 Subject: git-push-clone --- dot/local/bin/git-push-clone | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) (limited to 'dot/local/bin/git-push-clone') diff --git a/dot/local/bin/git-push-clone b/dot/local/bin/git-push-clone index b83b27f..703c9fd 100755 --- a/dot/local/bin/git-push-clone +++ b/dot/local/bin/git-push-clone @@ -5,7 +5,8 @@ usage() { cat < [refspec] + $0 [git-push options...] [refspec] + $0 <--all|--mirror|--tags> [git-push options...] EOF } @@ -27,9 +28,9 @@ check_existence() quietly rsync "$rsync_dest" case $? in 23) return 0;; - 0) die "Destination already exists: '$rsync_dest'";; + 0) [ "$NO_ACT" ] || die "Destination already exists: '$rsync_dest'";; *) die "rsync returned $? when checking for destination existence.";; - esac) || [ "$NO_ACT" ] || exit + esac) || exit } git_init_push_checkout() @@ -108,18 +109,18 @@ parse_refspec() current_branch() { git status -bs|sed -ne 's/^## //p'; } REFSPEC_UNNEEDED= -option_count=0 +arg_count=$# for arg in "$@"; do case "$arg" in -h|--help|--usage) usage; exit;; --all|--mirror|--tags) REFSPEC_UNNEEDED=y;; - --) option_count=$((option_count+1)); break;; + --no-act) NO_ACT=y;; + --) arg_count=$((arg_count - 1)); break;; -*) ;; *) break;; esac - option_count=$((option_count+1)) + arg_count=$((arg_count - 1)) done -arg_count=$(($# - option_count)) case $arg_count in 1) -- cgit v1.2.3