Code

RelNotes: the first batch of topics graduated to 'master'
[git.git] / git-parse-remote.sh
index ea093d251d98af6a3d4df19e900d56df34d51572..484b2e61ccd6df166a8d6447556ccca4236840ad 100644 (file)
@@ -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="<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/<branch>
+"
+       fi
+       exit 1
+}