Skip to contentSkip to conversation

Unnecessary fetch warning

PATCH New Shawn Pearce 2 participants 2 messages Aug 11, 2016

lore
Share & tools
lore
#0 lore raw

Current 'next':

  $ git fetch
  Warning: No merge candidate found because value of config option
           "branch.sp/username-reflog.merge" does not match any remote branch fetched.

uhhh.. i asked for a fetch, not a merge.

I have no branch.*.merge or branch.*.remote in my .git/config, and I only use the remote.*.url/remote.*.fetch format for my remote configs.

Commit 62b339a5 added the warning, and its intended for pull, but it is tripping during fetch too.

What about removing this warning from fetch, letting it mark everything as not-for-merge and let pull trigger the warning instead?

#1 lore raw

PATCH 1/1 Move "no merge candidate" warning into git-pull

The warning triggered even when running "git fetch" only when resulting .git/FETCH_HEAD only contained branches marked as 'not-for-merge'.

---

[Resent to mailing list; I forgot to add it]

Quoted 7 lines · Shawn Pearce

Current 'next':

  $ git fetch
  Warning: No merge candidate found because value of config option
           "branch.sp/username-reflog.merge" does not match any remote branch fetched.

uhhh.. i asked for a fetch, not a merge.

Oops.
I hope this does it right. Testing by the same person which does the patch is obviously almost the same as not testing at all.

Josef

 git-parse-remote.sh |   10 ----------
 git-pull.sh         |    4 ++++
 2 files changed, 4 insertions(+), 10 deletions(-)
git-parse-remote.sh +0 -10
index 6ae534b..d02f404 100755
@@ -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
@@ -173,10 +172,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/*) ;;
@@ -197,11 +192,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)
git-pull.sh +4 -0
index e23beb6..1703091 100755
@@ -76,6 +76,10 @@ merge_head=$(sed -e '/	not-for-merge	/d' \
 
 case "$merge_head" in
 '')
+	curr_branch=$(git-symbolic-ref HEAD | \
+		sed -e 's|^refs/heads/||')
+	echo >&2 "Warning: No merge candidate found because value of config option
+         \"branch.${curr_branch}.merge\" does not match any remote branch fetched."
 	echo >&2 "No changes."
 	exit 0
 	;;
Signature · 1 line
1.4.4.2.gee60-dirty