git/git-push.sh
c.shoemaker@cox.net c485104741 Add usage help to git-push.sh
Also clarify failure to push to read-only remote.  Especially,
state why rsync:// is not used for pushing.

[jc: ideally rsync should not be used for anything]

Signed-off-by: Chris Shoemaker <c.shoemaker at cox.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-10-28 22:26:16 -07:00

61 lines
1.1 KiB
Bash
Executable file

#!/bin/sh
. git-sh-setup || die "Not a git archive"
usage () {
die "Usage: git push [--all] [--force] <repository> [<refspec>]"
}
# Parse out parameters and then stop at remote, so that we can
# translate it using .git/branches information
has_all=
has_force=
has_exec=
remote=
while case "$#" in 0) break ;; esac
do
case "$1" in
--all)
has_all=--all ;;
--force)
has_force=--force ;;
--exec=*)
has_exec="$1" ;;
-*)
usage ;;
*)
set x "$@"
shift
break ;;
esac
shift
done
case "$#" in
0)
echo "Where would you want to push today?"
usage ;;
esac
. git-parse-remote
remote=$(get_remote_url "$@")
case "$has_all" in
--all) set x ;;
'') set x $(get_remote_refs_for_push "$@") ;;
esac
shift
case "$remote" in
http://* | https://* | git://*)
die "Cannot use READ-ONLY transport to push to $remote" ;;
rsync://*)
die "Pushing with rsync transport is deprecated" ;;
esac
set x "$remote" "$@"; shift
test "$has_all" && set x "$has_all" "$@" && shift
test "$has_force" && set x "$has_force" "$@" && shift
test "$has_exec" && set x "$has_exec" "$@" && shift
exec git-send-pack "$@"