Make git-pull complain and give advice when there is nothing to merge with
Signed-off-by: Federico Mena Quintero <federico@gnu.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Federico Mena Quintero committed
Oct 2, 2007 at 18:36 UTC
8fc293cb1e639c9ea555a8e95e3a7801fc1d1be8
1 file changed
+18
-4
git-pull.sh
+18
-4
@@ -97,10 +97,24 @@ case "$merge_head" in
97
esac
98
curr_branch=${curr_branch#refs/heads/}
99
100
- echo >&2 "Warning: No merge candidate found because value of config option
101
- \"branch.${curr_branch}.merge\" does not match any remote branch fetched."
102
- echo >&2 "No changes."
103
- exit 0
100
+ echo >&2 "You asked me to pull without telling me which branch you"
101
+ echo >&2 "want to merge with, and 'branch.${curr_branch}.merge' in"
102
+ echo >&2 "your configuration file does not tell me either. Please"
103
+ echo >&2 "name which branch you want to merge on the command line and"
104
+ echo >&2 "try again (e.g. 'git pull <repository> <refspec>')."
105
+ echo >&2 "See git-pull(1) for details on the refspec."
106
+ echo >&2
107
+ echo >&2 "If you often merge with the same branch, you may want to"
108
+ echo >&2 "configure the following variables in your configuration"
109
+ echo >&2 "file:"
110
+ echo >&2
111
+ echo >&2 " branch.${curr_branch}.remote = <nickname>"
112
+ echo >&2 " branch.${curr_branch}.merge = <remote-ref>"
113
+ echo >&2 " remote.<nickname>.url = <url>"
114
+ echo >&2 " remote.<nickname>.fetch = <refspec>"
115
+ echo >&2
116
+ echo >&2 "See git-config(1) for details."
117
+ exit 1
118
;;
119
?*' '?*)
120
if test -z "$orig_head"