X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=git-parse-remote.sh;h=484b2e61ccd6df166a8d6447556ccca4236840ad;hb=HEAD;hp=ea093d251d98af6a3d4df19e900d56df34d51572;hpb=69d61daec7a7915f6a664f32002fd9403e7f2a34;p=git.git diff --git a/git-parse-remote.sh b/git-parse-remote.sh index ea093d251..484b2e61c 100644 --- a/git-parse-remote.sh +++ b/git-parse-remote.sh @@ -50,3 +50,38 @@ get_remote_merge_branch () { esac esac } + +error_on_missing_default_upstream () { + cmd="$1" + op_type="$2" + op_prep="$3" + example="$4" + branch_name=$(git symbolic-ref -q HEAD) + # If there's only one remote, use that in the suggestion + remote="" + if test $(git remote | wc -l) = 1 + then + remote=$(git remote) + fi + + if test -z "$branch_name" + then + echo "You are not currently on a branch. Please specify which +branch you want to $op_type $op_prep. See git-${cmd}(1) for details. + + $example +" + else + echo "There is no tracking information for the current branch. +Please specify which branch you want to $op_type $op_prep. +See git-${cmd}(1) for details + + $example + +If you wish to set tracking information for this branch you can do so with: + + git branch --set-upstream ${branch_name#refs/heads/} $remote/ +" + fi + exit 1 +}