diff options
Diffstat (limited to 'dot/local/bin/git-push-clone')
-rwxr-xr-x | dot/local/bin/git-push-clone | 15 |
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 |
7 | Usage: | 7 | Usage: |
8 | $0 [git-push options] <destination> [refspec] | 8 | $0 [git-push options...] <destination> [refspec] |
9 | $0 <--all|--mirror|--tags> [git-push options...] <destination> | ||
9 | EOF | 10 | EOF |
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 | ||
35 | git_init_push_checkout() | 36 | git_init_push_checkout() |
@@ -108,18 +109,18 @@ parse_refspec() | |||
108 | current_branch() { git status -bs|sed -ne 's/^## //p'; } | 109 | current_branch() { git status -bs|sed -ne 's/^## //p'; } |
109 | 110 | ||
110 | REFSPEC_UNNEEDED= | 111 | REFSPEC_UNNEEDED= |
111 | option_count=0 | 112 | arg_count=$# |
112 | for arg in "$@"; do | 113 | for 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)) |
121 | done | 123 | done |
122 | arg_count=$(($# - option_count)) | ||
123 | 124 | ||
124 | case $arg_count in | 125 | case $arg_count in |
125 | 1) | 126 | 1) |