From: "Shawn O. Pearce" <spearce@spearce.org>
To: Junio C Hamano <junkio@cox.net>
Cc: git@vger.kernel.org
Subject: [PATCH] Only warn about missing branch.<n>.merge in pull.
Date: Mon, 18 Dec 2006 04:12:06 -0500 [thread overview]
Message-ID: <20061218091206.GA11284@spearce.org> (raw)
Commit 62b339a5 added a warning for git-pull to notify the user when
they have not configured the setting 'branch.<n>.merge' (where <n>
is the current branch) and no arguments were given to git-pull to
specify the branches to merge.
Unfortunately this warning also appears in git-fetch when no
arguments were supplied, as the warning is being output at the
same time that the contents of FETCH_HEAD is being determined.
This causes users who fetch into local tracking branches prior
to merging to receive unexpected/unnecessary warnings:
$ git fetch
Warning: No merge candidate found because value of config option
"branch.sp/topic.merge" does not match any remote branch fetched.
This warning may also cause problems for other Porcelain that use
git-fetch as "plumbing", as the other Porcelain may not actually
use (or honor) the branch.<n>.merge configuration option.
Instead we should delay the warning about no matching branches until
we are actually in git-pull and are trying to setup the call to
git-merge to actually carry out the merge. This way direct users
of git-fetch do not receive these warnings.
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
---
git-parse-remote.sh | 10 ----------
git-pull.sh | 16 +++++++++++++++-
2 files changed, 15 insertions(+), 11 deletions(-)
diff --git a/git-parse-remote.sh b/git-parse-remote.sh
index f27c3c2..7a1cf5c 100755
--- a/git-parse-remote.sh
+++ b/git-parse-remote.sh
@@ -134,7 +134,6 @@ 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
@@ -174,10 +173,6 @@ 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/*) ;;
@@ -198,11 +193,6 @@ 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)
diff --git a/git-pull.sh b/git-pull.sh
index e23beb6..d43a565 100755
--- a/git-pull.sh
+++ b/git-pull.sh
@@ -76,7 +76,21 @@ merge_head=$(sed -e '/ not-for-merge /d' \
case "$merge_head" in
'')
- echo >&2 "No changes."
+ echo >&2 "warning: No branches were selected for merge."
+ if test $# = 0
+ then
+ branch=$(git-symbolic-ref HEAD | sed -e 's|^refs/heads/||')
+ remote=$(git-repo-config --get-all "branch.$branch.remote")
+ if test -z "$remote"
+ then
+ echo >&2 "warning: (Config option 'branch.$branch.remote' not set.)"
+ fi
+ merge=$(git-repo-config --get-all "branch.$branch.merge")
+ if test -z "$merge"
+ then
+ echo >&2 "warning: (Config option 'branch.$branch.merge' not set.)"
+ fi
+ fi
exit 0
;;
?*' '?*)
--
next reply other threads:[~2006-12-18 9:12 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-12-18 9:12 Shawn O. Pearce [this message]
2006-12-18 11:06 ` [PATCH] Only warn about missing branch.<n>.merge in pull Santi Béjar
[not found] ` <7virg9xcvw.fsf@assigned-by-dhcp.cox.net>
[not found] ` <Pine.LNX.4.63.0612182135360.19693@wbgn013.biozentrum.uni-wuerzburg.de>
2006-12-19 0:59 ` Josef Weidendorfer
2006-12-19 1:14 ` Junio C Hamano
2006-12-19 10:28 ` Johannes Schindelin
2006-12-19 10:37 ` Junio C Hamano
2006-12-19 10:30 ` Johannes Schindelin
[not found] ` <20061218202803.GB28925@mellanox.co.il>
2006-12-19 6:54 ` Shawn Pearce
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20061218091206.GA11284@spearce.org \
--to=spearce@spearce.org \
--cc=git@vger.kernel.org \
--cc=junkio@cox.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.