summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLibravatar Junio C Hamano <gitster@pobox.com>2010-06-13 11:21:55 -0700
committerLibravatar Junio C Hamano <gitster@pobox.com>2010-06-13 11:21:55 -0700
commit0267d8bf3c4081f17c0291876bd88e3aeeb25c56 (patch)
treef4e5eff02d402f004026724c29b7af628b944c2a
parentMerge branch 'ab/submodule-foreach-toplevel' (diff)
parentpull: do nothing on --dry-run (diff)
downloadtgif-0267d8bf3c4081f17c0291876bd88e3aeeb25c56.tar.xz
Merge branch 'jk/maint-pull-dry-run-noop'
* jk/maint-pull-dry-run-noop: pull: do nothing on --dry-run
-rwxr-xr-xgit-pull.sh7
1 files changed, 6 insertions, 1 deletions
diff --git a/git-pull.sh b/git-pull.sh
index 1a4729f7bb..a09a44ec4c 100755
--- a/git-pull.sh
+++ b/git-pull.sh
@@ -43,6 +43,7 @@ merge_args=
curr_branch=$(git symbolic-ref -q HEAD)
curr_branch_short="${curr_branch#refs/heads/}"
rebase=$(git config --bool branch.$curr_branch_short.rebase)
+dry_run=
while :
do
case "$1" in
@@ -104,6 +105,9 @@ do
--no-r|--no-re|--no-reb|--no-reba|--no-rebas|--no-rebase)
rebase=false
;;
+ --d|--dr|--dry|--dry-|--dry-r|--dry-ru|--dry-run)
+ dry_run=--dry-run
+ ;;
-h|--h|--he|--hel|--help)
usage
;;
@@ -216,7 +220,8 @@ test true = "$rebase" && {
done
}
orig_head=$(git rev-parse -q --verify HEAD)
-git fetch $verbosity $progress --update-head-ok "$@" || exit 1
+git fetch $verbosity $progress $dry_run --update-head-ok "$@" || exit 1
+test -z "$dry_run" || exit 0
curr_head=$(git rev-parse -q --verify HEAD)
if test -n "$orig_head" && test "$curr_head" != "$orig_head"