Add branch.*.merge warning and documentation update
This patch clarifies the meaning of the branch.*.merge option. Previously, if branch.*.merge was specified but did not match any ref, the message "No changes." was not really helpful regarding the misconfiguration. This patch adds a warning for this. Signed-off-by: Josef Weidendorfer <Josef.Weidendorfer@gmx.de> Signed-off-by: Junio C Hamano <junkio@cox.net>
Josef Weidendorfer committed
Dec 9, 2006 at 02:28 UTC
62b339a544b1fa5199de7571c460d770cb286e65
2 files changed
+20
-2
Documentation/config.txt
+9
-2
@@ -125,10 +125,17 @@ apply.whitespace::
125
126
branch.<name>.remote::
127
When in branch <name>, it tells `git fetch` which remote to fetch.
128
+ If this option is not given, `git fetch` defaults to remote "origin".
129
130
branch.<name>.merge::
130
- When in branch <name>, it tells `git fetch` the default remote branch
131
- to be merged.
131
+ When in branch <name>, it tells `git fetch` the default refspec to
132
+ be marked for merging in FETCH_HEAD. The value has exactly to match
133
+ a remote part of one of the refspecs which are fetched from the remote
134
+ given by "branch.<name>.remote".
135
+ The merge information is used by `git pull` (which at first calls
136
+ `git fetch`) to lookup the default branch for merging. Without
137
+ this option, `git pull` defaults to merge the first refspec fetched.
138
+ Specify multiple values to get an octopus merge.
139
140
pager.color::
141
A boolean to enable/disable colored output when the pager is in
git-parse-remote.sh
+11
@@ -134,6 +134,8 @@ canon_refs_list_for_fetch () {
134
# or the first one otherwise; add prefix . to the rest
135
# to prevent the secondary branches to be merged by default.
136
merge_branches=
137
+ found_mergeref=
138
+ curr_branch=
139
if test "$1" = "-d"
140
then
141
shift ; remote="$1" ; shift
@@ -171,6 +173,10 @@ canon_refs_list_for_fetch () {
173
dot_prefix= && break
174
done
175
fi
176
+ if test -z $dot_prefix
177
+ then
178
+ found_mergeref=true
179
+ fi
180
case "$remote" in
181
'') remote=HEAD ;;
182
refs/heads/* | refs/tags/* | refs/remotes/*) ;;
@@ -191,6 +197,11 @@ canon_refs_list_for_fetch () {
197
fi
198
echo "${dot_prefix}${force}${remote}:${local}"
199
done
200
+ if test -z "$found_mergeref" -a "$curr_branch"
201
+ then
202
+ echo >&2 "Warning: No merge candidate found because value of config option
203
+ \"branch.${curr_branch}.merge\" does not match any remote branch fetched."
204
+ fi
205
}
206
207
# Returns list of src: (no store), or src:dst (store)