Skip to content

Commit

Permalink
Add branch.*.merge warning and documentation update
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Josef Weidendorfer authored and Junio C Hamano committed Dec 9, 2006
1 parent 2cdf87e commit 62b339a
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 2 deletions.
11 changes: 9 additions & 2 deletions Documentation/config.txt
Original file line number Diff line number Diff line change
Expand Up @@ -125,10 +125,17 @@ apply.whitespace::

branch.<name>.remote::
When in branch <name>, it tells `git fetch` which remote to fetch.
If this option is not given, `git fetch` defaults to remote "origin".

branch.<name>.merge::
When in branch <name>, it tells `git fetch` the default remote branch
to be merged.
When in branch <name>, it tells `git fetch` the default refspec to
be marked for merging in FETCH_HEAD. The value has exactly to match
a remote part of one of the refspecs which are fetched from the remote
given by "branch.<name>.remote".
The merge information is used by `git pull` (which at first calls
`git fetch`) to lookup the default branch for merging. Without
this option, `git pull` defaults to merge the first refspec fetched.
Specify multiple values to get an octopus merge.

pager.color::
A boolean to enable/disable colored output when the pager is in
Expand Down
11 changes: 11 additions & 0 deletions git-parse-remote.sh
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,8 @@ canon_refs_list_for_fetch () {
# or the first one otherwise; add prefix . to the rest
# to prevent the secondary branches to be merged by default.
merge_branches=
found_mergeref=
curr_branch=
if test "$1" = "-d"
then
shift ; remote="$1" ; shift
Expand Down Expand Up @@ -171,6 +173,10 @@ canon_refs_list_for_fetch () {
dot_prefix= && break
done
fi
if test -z $dot_prefix
then
found_mergeref=true
fi
case "$remote" in
'') remote=HEAD ;;
refs/heads/* | refs/tags/* | refs/remotes/*) ;;
Expand All @@ -191,6 +197,11 @@ canon_refs_list_for_fetch () {
fi
echo "${dot_prefix}${force}${remote}:${local}"
done
if test -z "$found_mergeref" -a "$curr_branch"
then
echo >&2 "Warning: No merge candidate found because value of config option
\"branch.${curr_branch}.merge\" does not match any remote branch fetched."
fi
}

# Returns list of src: (no store), or src:dst (store)
Expand Down

0 comments on commit 62b339a

Please sign in to comment.