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

Re: What's in git.git (stable)

From
Junio C Hamano <junkio@cox.net>
Date
Dec 22, 2006, 21:44 UTC
Message-ID
<7vac1fy5ae.fsf@assigned-by-dhcp.cox.net>
In-Reply-To
<Pine.LNX.4.63.0612222141060.19693@wbgn013.biozentrum.uni-wuerzburg.de>
Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:
Show 8 quoted lines
> So, if I understand your option (2) correctly, it complains _only_ if 
> there is at least one branch.*.merge in the config, but not for the 
> current branch?
>
> I think that would safeguard the existing repositories _and_ the new ones, 
> because git-clone sets them up with such an entry to begin with.
>
> If that behaviour was meant by (2), I am all for it.

I am not quite sure about that. An old timer would work in a newly cloned repository after all, and what this "newbie protection" is breaking is not existing repositories but expectation from existing users.

In any case, here is a patch for discussion.
diff --git a/git-parse-remote.sh b/git-parse-remote.sh
index f163821..b4d071b 100755
--- a/git-parse-remote.sh
+++ b/git-parse-remote.sh
@@ -145,10 +145,22 @@ canon_refs_list_for_fetch () {
 			merge_branches=$(git-repo-config \
 			    --get-all "branch.${curr_branch}.merge")
 		fi
-		# If we are fetching only one branch, then first branch
-		# is the only thing that makes sense to merge anyway,
-		# so there is no point refusing that traditional rule.
-		if test $# != 1 && test "z$merge_branches" = z
+		if test "z$merge_branches" = z &&
+			# If we are fetching only one branch, then
+			# first branch is the only thing that makes
+			# sense to merge anyway, so there is no point
+			# refusing that traditional rule.
+			test $# != 1 &&
+
+			# Also, old timers have been happily working
+			# with the first branch rule without having
+			# any branch.*.merge configuration, so if
+			# there is none, do not bother with this
+			# "newbie protection".  A newly cloned
+			# repository would have branch.master.merge
+			# set for it.
+			git repo-config --get-regexp \
+				'^branch\..*\.merge$' >/dev/null
 		then
 			merge_branches=..this..would..never..match..
 		fi
Previous: Johannes SchindelinNext: Luben Tuikov
Message 10 of 20 in “What's in git.git (stable)”
  1. Junio C HamanoDec 22, 2006
  2. Randal L. SchwartzDec 22, 2006
  3. Randal L. SchwartzDec 22, 2006
  4. Johannes SchindelinDec 22, 2006
  5. Randal L. SchwartzDec 22, 2006
  6. Randal L. SchwartzDec 22, 2006
  7. Johannes SchindelinDec 22, 2006
  8. Junio C HamanoDec 22, 2006
  9. Johannes SchindelinDec 22, 2006
  10. Junio C HamanoDec 22, 2006
  11. Luben TuikovDec 26, 2006
  12. Junio C HamanoDec 26, 2006
  13. Luben TuikovDec 27, 2006
  14. Junio C HamanoDec 27, 2006
  15. Junio C HamanoDec 22, 2006
  16. Jakub NarebskiDec 22, 2006
  17. Junio C HamanoDec 22, 2006
  18. Jakub NarebskiDec 22, 2006
  19. Junio C HamanoDec 22, 2006
  20. Quy TonthatDec 22, 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.