X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=git-pull.sh;h=9e69ada413bd81948591a9e99287f97499573673;hb=1c6f5b52b7b13bbc6cf404cb5ef9e64fda37655c;hp=bfeb4a0ff65fabaa49b212411ee2451cbf656f3d;hpb=2dfb96c9fc925ce2f9cd6bd347bc15c1edc368fe;p=git.git diff --git a/git-pull.sh b/git-pull.sh index bfeb4a0ff..9e69ada41 100755 --- a/git-pull.sh +++ b/git-pull.sh @@ -91,45 +91,63 @@ error_on_no_merge_candidates () { esac done + if test true = "$rebase" + then + op_type=rebase + op_prep=against + else + op_type=merge + op_prep=with + fi + curr_branch=${curr_branch#refs/heads/} upstream=$(git config "branch.$curr_branch.merge") remote=$(git config "branch.$curr_branch.remote") if [ $# -gt 1 ]; then - echo "There are no candidates for merging in the refs that you just fetched." + if [ "$rebase" = true ]; then + printf "There is no candidate for rebasing against " + else + printf "There are no candidates for merging " + fi + echo "among the refs that you just fetched." echo "Generally this means that you provided a wildcard refspec which had no" echo "matches on the remote end." elif [ $# -gt 0 ] && [ "$1" != "$remote" ]; then echo "You asked to pull from the remote '$1', but did not specify" - echo "a branch to merge. Because this is not the default configured remote" + echo "a branch. Because this is not the default configured remote" echo "for your current branch, you must specify a branch on the command line." elif [ -z "$curr_branch" ]; then echo "You are not currently on a branch, so I cannot use any" echo "'branch..merge' in your configuration file." - echo "Please specify which branch you want to merge on the command" + echo "Please specify which remote branch you want to use on the command" echo "line and try again (e.g. 'git pull ')." echo "See git-pull(1) for details." elif [ -z "$upstream" ]; then echo "You asked me to pull without telling me which branch you" - echo "want to merge with, and 'branch.${curr_branch}.merge' in" - echo "your configuration file does not tell me either. Please" - echo "specify which branch you want to merge on the command line and" + echo "want to $op_type $op_prep, and 'branch.${curr_branch}.merge' in" + echo "your configuration file does not tell me, either. Please" + echo "specify which branch you want to use on the command line and" echo "try again (e.g. 'git pull ')." echo "See git-pull(1) for details." echo - echo "If you often merge with the same branch, you may want to" - echo "configure the following variables in your configuration" - echo "file:" + echo "If you often $op_type $op_prep the same branch, you may want to" + echo "use something like the following in your configuration file:" + echo + echo " [branch \"${curr_branch}\"]" + echo " remote = " + echo " merge = " + test rebase = "$op_type" && + echo " rebase = true" echo - echo " branch.${curr_branch}.remote = " - echo " branch.${curr_branch}.merge = " - echo " remote..url = " - echo " remote..fetch = " + echo " [remote \"\"]" + echo " url = " + echo " fetch = " echo echo "See git-config(1) for details." else - echo "Your configuration specifies to merge the ref '${upstream#refs/heads/}' from the" - echo "remote, but no such ref was fetched." + echo "Your configuration specifies to $op_type $op_prep the ref '${upstream#refs/heads/}'" + echo "from the remote, but no such ref was fetched." fi exit 1 }