Skip to content

Commit

Permalink
pull: Clarify "helpful" message for another corner case
Browse files Browse the repository at this point in the history
When the remote branch we asked for merging did not exist in the set of
fetched refs, we unconditionally hinted that it was because of lack of
configuration.  It is not necessarily so, and risks sending users for a
wild goose chase.

Make sure to check if that is indeed the case before telling a wild guess
to the user.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
  • Loading branch information
Junio C Hamano committed Sep 23, 2009
1 parent 3ddcb19 commit a6dbf88
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion git-pull.sh
Original file line number Diff line number Diff line change
Expand Up @@ -89,14 +89,15 @@ error_on_no_merge_candidates () {
done

curr_branch=${curr_branch#refs/heads/}
upstream=$(git config "branch.$curr_branch.merge")

if [ -z "$curr_branch" ]; then
echo "You are not currently on a branch, so I cannot use any"
echo "'branch.<branchname>.merge' in your configuration file."
echo "Please specify which branch you want to merge on the command"
echo "line and try again (e.g. 'git pull <repository> <refspec>')."
echo "See git-pull(1) for details."
else
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"
Expand All @@ -114,6 +115,10 @@ error_on_no_merge_candidates () {
echo " remote.<nickname>.fetch = <refspec>"
echo
echo "See git-config(1) for details."
else
echo "Your configuration specifies to merge the ref"
echo "'${upstream#refs/heads/}' from the remote, but no such ref"
echo "was fetched."
fi
exit 1
}
Expand Down

0 comments on commit a6dbf88

Please sign in to comment.