summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Cady <d@jerkface.net>2018-12-09 03:53:10 -0500
committerAndrew Cady <d@jerkface.net>2018-12-09 03:53:10 -0500
commitab41b2f851c79a51eb8fc22d7fd8ac60b802b964 (patch)
tree5512390660be4ba3d5e131455d5460c6cef0b016
parent4fd20f7eb3579527fe88345439963f5859d00711 (diff)
git-push-clone
-rwxr-xr-xdot/local/bin/git-push-clone15
1 files changed, 8 insertions, 7 deletions
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()
5{ 5{
6 cat <<EOF 6 cat <<EOF
7Usage: 7Usage:
8 $0 [git-push options] <destination> [refspec] 8 $0 [git-push options...] <destination> [refspec]
9 $0 <--all|--mirror|--tags> [git-push options...] <destination>
9EOF 10EOF
10} 11}
11 12
@@ -27,9 +28,9 @@ check_existence()
27 quietly rsync "$rsync_dest" 28 quietly rsync "$rsync_dest"
28 case $? in 29 case $? in
29 23) return 0;; 30 23) return 0;;
30 0) die "Destination already exists: '$rsync_dest'";; 31 0) [ "$NO_ACT" ] || die "Destination already exists: '$rsync_dest'";;
31 *) die "rsync returned $? when checking for destination existence.";; 32 *) die "rsync returned $? when checking for destination existence.";;
32 esac) || [ "$NO_ACT" ] || exit 33 esac) || exit
33} 34}
34 35
35git_init_push_checkout() 36git_init_push_checkout()
@@ -108,18 +109,18 @@ parse_refspec()
108current_branch() { git status -bs|sed -ne 's/^## //p'; } 109current_branch() { git status -bs|sed -ne 's/^## //p'; }
109 110
110REFSPEC_UNNEEDED= 111REFSPEC_UNNEEDED=
111option_count=0 112arg_count=$#
112for arg in "$@"; do 113for arg in "$@"; do
113 case "$arg" in 114 case "$arg" in
114 -h|--help|--usage) usage; exit;; 115 -h|--help|--usage) usage; exit;;
115 --all|--mirror|--tags) REFSPEC_UNNEEDED=y;; 116 --all|--mirror|--tags) REFSPEC_UNNEEDED=y;;
116 --) option_count=$((option_count+1)); break;; 117 --no-act) NO_ACT=y;;
118 --) arg_count=$((arg_count - 1)); break;;
117 -*) ;; 119 -*) ;;
118 *) break;; 120 *) break;;
119 esac 121 esac
120 option_count=$((option_count+1)) 122 arg_count=$((arg_count - 1))
121done 123done
122arg_count=$(($# - option_count))
123 124
124case $arg_count in 125case $arg_count in
125 1) 126 1)