git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH] Add branch.*.merge warning and documentation update

From
JWJosef Weidendorfer <josef.weidendorfer@gmx.de>
Date
Dec 9, 2006, 01:28 UTC
Message-ID
<200612090228.26722.Josef.Weidendorfer@gmx.de>
In-Reply-To
<7vu006ez1i.fsf@assigned-by-dhcp.cox.net>

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>
---
On Saturday 09 December 2006 00:41, Junio C Hamano wrote:
Show 9 quoted lines
> Josef Weidendorfer <Josef.Weidendorfer@gmx.de> writes:
> 
> > But the previous documentation simply was way to short.
> 
> Yes, your documentation updates seems to make it much clearer.
> 
> > Should I send a "simplified" patch?
> 
> Thanks, appreciated.
Done.
Josef
 Documentation/config.txt |   11 +++++++++--
 git-parse-remote.sh      |   11 +++++++++++
 2 files changed, 20 insertions(+), 2 deletions(-)
diff --git a/Documentation/config.txt b/Documentation/config.txt
index 9090762..21ec557 100644
--- a/Documentation/config.txt
+++ b/Documentation/config.txt
@@ -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
diff --git a/git-parse-remote.sh b/git-parse-remote.sh
index da064a5..d72f061 100755
--- a/git-parse-remote.sh
+++ b/git-parse-remote.sh
@@ -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
@@ -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/*) ;;
@@ -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)
-- 
1.4.4.2.g1d08-dirty
Previous: Junio C HamanoNext: Santi Béjar
Message 25 of 36 in “git pull and merging.”
  1. Aneesh KumarDec 6, 2006
  2. Junio C HamanoDec 6, 2006
  3. Aneesh KumarDec 6, 2006
  4. Johannes SchindelinDec 6, 2006
  5. Peter BaumannDec 6, 2006
  6. Johannes SchindelinDec 6, 2006
  7. Peter BaumannDec 6, 2006
  8. Aneesh KumarDec 6, 2006
  9. Jakub NarebskiDec 6, 2006
  10. Josef WeidendorferDec 6, 2006
  11. Aneesh Kumar K.VDec 7, 2006
  12. Josef WeidendorferDec 7, 2006
  13. Junio C HamanoDec 7, 2006
  14. Josef WeidendorferDec 7, 2006
  15. Santi BéjarDec 8, 2006
  16. Josef WeidendorferDec 8, 2006
  17. Add branch.*.localmerge and documentation updateJosef Weidendorfer, Dec 8, 2006
  18. Santi BéjarDec 8, 2006
  19. Junio C HamanoDec 8, 2006
  20. Jakub NarebskiDec 8, 2006
  21. Josef WeidendorferDec 8, 2006
  22. Junio C HamanoDec 8, 2006
  23. Josef WeidendorferDec 8, 2006
  24. Junio C HamanoDec 8, 2006
  25. Add branch.*.merge warning and documentation updateJosef Weidendorfer, Dec 9, 2006
  26. Santi BéjarDec 9, 2006
  27. Josef WeidendorferDec 8, 2006
  28. Santi BéjarDec 8, 2006
  29. Santi BéjarDec 8, 2006
  30. Junio C HamanoDec 8, 2006
  31. Junio C HamanoDec 7, 2006
  32. Santi BéjarDec 8, 2006
  33. Jakub NarebskiDec 8, 2006
  34. Jakub NarebskiDec 6, 2006
  35. Johannes SchindelinDec 6, 2006
  36. Fwd: git pull and merging.Aneesh Kumar, Dec 6, 2006

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.