Commit 1a51688b authored by Brad King's avatar Brad King Committed by Code Review

Merge topic 'git-gerrit-push-dryrun' into master

376d0b93 Teach "git gerrit-push" new --dry-run option
parents 6257ab9f 376d0b93
#!/usr/bin/env bash
USAGE="[<remote>] [--no-topic] [--]"
USAGE="[<remote>] [--no-topic] [--dry-run] [--]"
OPTIONS_SPEC=
SUBDIRECTORY_OK=Yes
. "$(git --exec-path)/git-sh-setup"
#-----------------------------------------------------------------------------
remote=''
refspecs=''
no_topic=''
dry_run=''
# Parse the command line options.
while test $# != 0; do
case "$1" in
--no-topic) no_topic=1 ;;
--dry-run) dry_run=--dry-run ;;
--) shift; break ;;
-*) usage ;;
*) test -z "$remote" || usage ; remote="$1" ;;
......@@ -44,8 +49,10 @@ fi
echo "Fetching $remote master"
fetch_out=$(git fetch "$remote" master 2>&1) || die "$fetch_out"
# Now push the topic branch
# Push. Save output and exit code.
echo "Pushing to $remote"
push_stdout=$(git push --porcelain "$remote" $refspecs); push_exit=$?
push_stdout=$(git push --porcelain $dry_run "$remote" $refspecs); push_exit=$?
echo "$push_stdout"
# Reproduce the push exit code.
exit $push_exit
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment