{"thread":{"id":"5013","subject":"[PATCH] mailinfo: accept >From in message header","startedAt":"2006-07-27T14:03:43Z","lastAt":"2006-08-23T01:34:29Z","messageCount":27,"participants":["Michael S. Tsirkin","Junio C Hamano","Jakub Narebski"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"24204","messageId":"20060727140343.GS9411@mellanox.co.il","threadId":"5013","inReplyTo":null,"subject":"[PATCH] mailinfo: accept >From in message header","fromName":"Michael S. Tsirkin","fromEmail":"mst@mellanox.co.il","sentAt":"2006-07-27T14:03:43Z","receivedAt":"2006-07-27T14:03:43Z","isPatch":true,"sender":{"key":"mst@kernel.org","avatar":null},"body":"Hi!\nMail I get sometimes has multiple From lines, like this:\n\n>From Majordomo@vger.kernel.org  Thu Jul 27 16:39:36 2006\n>From mtsirkin  Thu Jul 27 16:39:36 2006\nReceived: from yok.mtl.com [10.0.8.11]\n....\n\nwhich confuses git-mailinfo since that does not recognize >From\nas a valid header line. The following patch makes git-applymbox\nwork for me:\n\n---\n\nRecognize >From XXX as a valid header line.\n\nSigned-off-by: Michael S. Tsirkin <mst@mellanox.co.il>\n\ndiff --git a/builtin-mailinfo.c b/builtin-mailinfo.c\nindex ac53f76..2b6e9fa 100644\n--- a/builtin-mailinfo.c\n+++ b/builtin-mailinfo.c\n@@ -446,7 +446,7 @@ static int read_one_header_line(char *li\n \t\t\tbreak;\n \t}\n \t/* Count mbox From headers as headers */\n-\tif (!ofs && !memcmp(line, \"From \", 5))\n+\tif (!ofs && (!memcmp(line, \"From \", 5) || !memcmp(line, \">From \", 6)))\n \t\tofs = 1;\n \treturn ofs;\n }\n\n-- \nMST\n"},{"id":"24263","messageId":"7vbqraoi9s.fsf@assigned-by-dhcp.cox.net","threadId":"5013","inReplyTo":"20060727140343.GS9411@mellanox.co.il","subject":"Re: [PATCH] mailinfo: accept >From in message header","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2006-07-27T21:22:07Z","receivedAt":"2006-07-27T21:22:07Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"\"Michael S. Tsirkin\" <mst@mellanox.co.il> writes:\n\n> From Majordomo@vger.kernel.org  Thu Jul 27 16:39:36 2006\n>>From mtsirkin  Thu Jul 27 16:39:36 2006\n> Received: from yok.mtl.com [10.0.8.11]\n> ....\n>\n> which confuses git-mailinfo since that does not recognize >From\n> as a valid header line. The following patch makes git-applymbox\n> work for me:\n\nWouldn't that kind of breakage confuse git-mailsplit as well?\n"},{"id":"24264","messageId":"20060727213251.GA17234@mellanox.co.il","threadId":"5013","inReplyTo":"7vbqraoi9s.fsf@assigned-by-dhcp.cox.net","subject":"Re: [PATCH] mailinfo: accept >From in message header","fromName":"Michael S. Tsirkin","fromEmail":"mst@mellanox.co.il","sentAt":"2006-07-27T21:32:52Z","receivedAt":"2006-07-27T21:32:52Z","isPatch":true,"sender":{"key":"mst@kernel.org","avatar":null},"body":"Quoting r. Junio C Hamano <junkio@cox.net>:\n> Subject: Re: [PATCH] mailinfo: accept >From in message header\n> \n> \"Michael S. Tsirkin\" <mst@mellanox.co.il> writes:\n> \n> > From Majordomo@vger.kernel.org  Thu Jul 27 16:39:36 2006\n> >>From mtsirkin  Thu Jul 27 16:39:36 2006\n> > Received: from yok.mtl.com [10.0.8.11]\n> > ....\n> >\n> > which confuses git-mailinfo since that does not recognize >From\n> > as a valid header line. The following patch makes git-applymbox\n> > work for me:\n> \n> Wouldn't that kind of breakage confuse git-mailsplit as well?\n> \n\nHmm - I normally don't use it - just pipe stiff from mutt into git-applymbox.\nA quick test seems to indicate git-mailsplit works fine.\n\nBut why should it - mailsplit just needs ^From to match new mail,\ncorrect? So the escaped >From is good for it.\n\n-- \nMST\n"},{"id":"24920","messageId":"20060807125116.GA28658@mellanox.co.il","threadId":"5013","inReplyTo":"20060727140343.GS9411@mellanox.co.il","subject":"Multiple pulls from the same branch in .git/remotes/origin","fromName":"Michael S. Tsirkin","fromEmail":"mst@mellanox.co.il","sentAt":"2006-08-07T12:51:16Z","receivedAt":"2006-08-07T12:51:16Z","isPatch":false,"sender":{"key":"mst@kernel.org","avatar":null},"body":"Hi, all!\nI have\n> git --version\ngit version 1.4.2.rc3.g0d95\nand I have put the following in .git/remotes/origin\n\n>cat .git/remotes/origin\nURL: ssh://mst@frodo/scm/git/linux-2.6\nPull: refs/heads/linus_master:refs/heads/origin\nPull: refs/heads/linus_master:refs/heads/linus_master_branch\n\nnow I get:\n\n>git fetch origin\nerror: no such remote ref refs/heads/linus_master\nFetch failure: ssh://mst@frodo/scm/git/linux-2.6\n\nHowever, if I remove the second line, like this:\n\n>cat .git/remotes/origin\nURL: ssh://mst@frodo/scm/git/linux-2.6\nPull: refs/heads/linus_master:refs/heads/origin\n\nI get remote linus_master properly fetched into local origin.\nTwo questions:\n1. Isn't is possible to pull from the same remote branch into multiple local\n   branches?\n2. Even if not, isn't the error message above a bit strange?\n   After all, the remote branch *does* exist.\n\nThanks,\n\n-- \nMST\n"},{"id":"24933","messageId":"7vd5bc4czr.fsf@assigned-by-dhcp.cox.net","threadId":"5013","inReplyTo":"20060807125116.GA28658@mellanox.co.il","subject":"Re: Multiple pulls from the same branch in .git/remotes/origin","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2006-08-07T18:28:08Z","receivedAt":"2006-08-07T18:28:08Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"\"Michael S. Tsirkin\" <mst@mellanox.co.il> writes:\n\n> I get remote linus_master properly fetched into local origin.\n> Two questions:\n\n> 1. Isn't is possible to pull from the same remote branch into multiple local\n>    branches?\n\nCurrently, no.  The underlying git-fetch-pack makes sure you do\nnot give the same branches twice on the command line.  I think\nwhat the code actually tries to do is to make sure each of the\ngiven refspecs is not ambiguous and matches something, but while\ndoing so it marks the remote ref that matched ineligible to\nmatch again, which ends up showing the error message you saw.\n\nIt might not be too difficult to change it though.  This part of\nthe code is relatively old and I do not remember the details\noffhand, other than I remember that the first time I saw it I\nhad the same confused \"Huh?  we do not let a ref fetched twice?\"\nreaction ;-).\n"},{"id":"24940","messageId":"20060807193809.GA24013@mellanox.co.il","threadId":"5013","inReplyTo":"7vd5bc4czr.fsf@assigned-by-dhcp.cox.net","subject":"Re: Multiple pulls from the same branch in .git/remotes/origin","fromName":"Michael S. Tsirkin","fromEmail":"mst@mellanox.co.il","sentAt":"2006-08-07T19:38:09Z","receivedAt":"2006-08-07T19:38:09Z","isPatch":false,"sender":{"key":"mst@kernel.org","avatar":null},"body":"Quoting r. Junio C Hamano <junkio@cox.net>:\n> Subject: Re: Multiple pulls from the same branch in .git/remotes/origin\n> \n> \"Michael S. Tsirkin\" <mst@mellanox.co.il> writes:\n> \n> > I get remote linus_master properly fetched into local origin.\n> > Two questions:\n> \n> > 1. Isn't is possible to pull from the same remote branch into multiple local\n> >    branches?\n> \n> Currently, no.  The underlying git-fetch-pack makes sure you do\n> not give the same branches twice on the command line.  I think\n> what the code actually tries to do is to make sure each of the\n> given refspecs is not ambiguous and matches something, but while\n> doing so it marks the remote ref that matched ineligible to\n> match again, which ends up showing the error message you saw.\n> \n> It might not be too difficult to change it though.  This part of\n> the code is relatively old and I do not remember the details\n> offhand, other than I remember that the first time I saw it I\n> had the same confused \"Huh?  we do not let a ref fetched twice?\"\n> reaction ;-).\n\nAt least, fix the error message?\n\n-- \nMST\n"},{"id":"24945","messageId":"7vu04o1fwm.fsf@assigned-by-dhcp.cox.net","threadId":"5013","inReplyTo":"20060807193809.GA24013@mellanox.co.il","subject":"Re: Multiple pulls from the same branch in .git/remotes/origin","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2006-08-07T19:53:29Z","receivedAt":"2006-08-07T19:53:29Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"\"Michael S. Tsirkin\" <mst@mellanox.co.il> writes:\n\n>> It might not be too difficult to change it though.  This part of\n>> the code is relatively old and I do not remember the details\n>> offhand, other than I remember that the first time I saw it I\n>> had the same confused \"Huh?  we do not let a ref fetched twice?\"\n>> reaction ;-).\n>\n> At least, fix the error message?\n\nThat would touch the same vicinity of code so if I were to do\nthat myself I would rather see if the restriction can be\nloosened properly first.\n"},{"id":"24950","messageId":"20060807210545.GC24206@mellanox.co.il","threadId":"5013","inReplyTo":"7vu04o1fwm.fsf@assigned-by-dhcp.cox.net","subject":"Re: Multiple pulls from the same branch in .git/remotes/origin","fromName":"Michael S. Tsirkin","fromEmail":"mst@mellanox.co.il","sentAt":"2006-08-07T21:05:45Z","receivedAt":"2006-08-07T21:05:45Z","isPatch":false,"sender":{"key":"mst@kernel.org","avatar":null},"body":"Quoting r. Junio C Hamano <junkio@cox.net>:\n> Subject: Re: Multiple pulls from the same branch in .git/remotes/origin\n> \n> \"Michael S. Tsirkin\" <mst@mellanox.co.il> writes:\n> \n> >> It might not be too difficult to change it though.  This part of\n> >> the code is relatively old and I do not remember the details\n> >> offhand, other than I remember that the first time I saw it I\n> >> had the same confused \"Huh?  we do not let a ref fetched twice?\"\n> >> reaction ;-).\n> >\n> > At least, fix the error message?\n> \n> That would touch the same vicinity of code so if I were to do\n> that myself I would rather see if the restriction can be\n> loosened properly first.\n\nIt seems that have to make path_match in connect.c return an array\nof indexes for that to work. Right?\n\n-- \nMST\n"},{"id":"24954","messageId":"7vzmegyzgb.fsf@assigned-by-dhcp.cox.net","threadId":"5013","inReplyTo":"20060807210545.GC24206@mellanox.co.il","subject":"Re: Multiple pulls from the same branch in .git/remotes/origin","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2006-08-07T22:04:52Z","receivedAt":"2006-08-07T22:04:52Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"\"Michael S. Tsirkin\" <mst@mellanox.co.il> writes:\n\n> It seems that have to make path_match in connect.c return an array\n> of indexes for that to work. Right?\n\nI do not recall why Linus placed that \"*s = 0\" in there.  That\nis the one that makes the same ref not match more than once.\n\nIt _could_ be that the fix is just the matter of removing that\nline, but it may have interesting consequences; I dunno offhand.\n"},{"id":"24956","messageId":"20060807221914.GA24393@mellanox.co.il","threadId":"5013","inReplyTo":"7vu04o1fwm.fsf@assigned-by-dhcp.cox.net","subject":"[PATCH] Multiple refs from the same remote in one git fetch","fromName":"Michael S. Tsirkin","fromEmail":"mst@mellanox.co.il","sentAt":"2006-08-07T22:19:14Z","receivedAt":"2006-08-07T22:19:14Z","isPatch":true,"sender":{"key":"mst@kernel.org","avatar":null},"body":"Quoting r. Junio C Hamano <junkio@cox.net>:\n> > At least, fix the error message?\n> \n> That would touch the same vicinity of code so if I were to do\n> that myself I would rather see if the restriction can be\n> loosened properly first.\n\nThe following seems to fix this issue: simply scan the full\nrefspec list for each remote instead of breaking on the first match.\nI had to touch the git-fetch.sh script as well as it is scanning\nthe remote list, too. Works for me.\n\n---\n\nFix git fetch for when multiple refspecs reference the same remote head.\n\nSigned-off-by: Michael S. Tsirkin <mst@mellanox.co.il>\n\ndiff --git a/Makefile b/Makefile\ndiff --git a/connect.c b/connect.c\nindex 4422a0d..3880191 100644\n--- a/connect.c\n+++ b/connect.c\n@@ -115,6 +115,7 @@ int get_ack(int fd, unsigned char *resul\n int path_match(const char *path, int nr, char **match)\n {\n \tint i;\n+\tint found = 0;\n \tint pathlen = strlen(path);\n \n \tfor (i = 0; i < nr; i++) {\n@@ -128,9 +129,9 @@ int path_match(const char *path, int nr,\n \t\tif (pathlen > len && path[pathlen - len - 1] != '/')\n \t\t\tcontinue;\n \t\t*s = 0;\n-\t\treturn (i + 1);\n+\t\tfound = i + 1;\n \t}\n-\treturn 0;\n+\treturn found;\n }\n \n struct refspec {\ndiff --git a/fetch-pack.c b/fetch-pack.c\ndiff --git a/git-fetch.sh b/git-fetch.sh\nindex c2eebee..c35bae6 100755\n--- a/git-fetch.sh\n+++ b/git-fetch.sh\n@@ -373,26 +373,22 @@ fetch_main () {\n \t      +$remote_name:*)\n \t\t  single_force=t\n \t\t  not_for_merge=\n-\t\t  found=\"$ref\"\n-\t\t  break ;;\n+\t\t  found=\"$ref\";;\n \t      .+$remote_name:*)\n \t\t  single_force=t\n \t\t  not_for_merge=t\n-\t\t  found=\"$ref\"\n-\t\t  break ;;\n+\t\t  found=\"$ref\";;\n \t      .$remote_name:*)\n \t\t  not_for_merge=t\n-\t\t  found=\"$ref\"\n-\t\t  break ;;\n+\t\t  found=\"$ref\";;\n \t      $remote_name:*)\n \t\t  not_for_merge=\n-\t\t  found=\"$ref\"\n-\t\t  break ;;\n+\t\t  found=\"$ref\";;\n \t      esac\n-\t  done\n-\t  local_name=$(expr \"z$found\" : 'z[^:]*:\\(.*\\)')\n-\t  append_fetch_head \"$sha1\" \"$remote\" \\\n+\t      local_name=$(expr \"z$found\" : 'z[^:]*:\\(.*\\)')\n+\t      append_fetch_head \"$sha1\" \"$remote\" \\\n \t\t  \"$remote_name\" \"$remote_nick\" \"$local_name\" \"$not_for_merge\"\n+\t  done\n       done\n     ) || exit ;;\n   esac\n\n-- \nMST\n"},{"id":"24958","messageId":"20060807223315.GB24393@mellanox.co.il","threadId":"5013","inReplyTo":"7vzmegyzgb.fsf@assigned-by-dhcp.cox.net","subject":"Re: Multiple pulls from the same branch in .git/remotes/origin","fromName":"Michael S. Tsirkin","fromEmail":"mst@mellanox.co.il","sentAt":"2006-08-07T22:33:15Z","receivedAt":"2006-08-07T22:33:15Z","isPatch":false,"sender":{"key":"mst@kernel.org","avatar":null},"body":"Quoting r. Junio C Hamano <junkio@cox.net>:\n> Subject: Re: Multiple pulls from the same branch in .git/remotes/origin\n> \n> \"Michael S. Tsirkin\" <mst@mellanox.co.il> writes:\n> \n> > It seems that have to make path_match in connect.c return an array\n> > of indexes for that to work. Right?\n> \n> I do not recall why Linus placed that \"*s = 0\" in there.  That\n> is the one that makes the same ref not match more than once.\n\nHmm, as I read it, this marks the *match* as already found.\nThis seems to be what makes the sanity check in main work:\n\n                /* If the heads to pull were given, we should have\n                 * consumed all of them by matching the remote.\n                 * Otherwise, 'git-fetch remote no-such-ref' would\n                 * silently succeed without issuing an error.\n                 */\n\nWhat stops it is return i + 1 in path_match, no?\nI think the issue is that path_match will stop at first match and not\nlabel multiple matches, so later sanity check in main errors out.\n\n> It _could_ be that the fix is just the matter of removing that\n> line, but it may have interesting consequences; I dunno offhand.\n> \n> \n\nWhat I did is just scan the full list of refspecs instead of breaking\nout at the first match.\n\n-- \nMST\n"},{"id":"24961","messageId":"7vr6zsywmq.fsf@assigned-by-dhcp.cox.net","threadId":"5013","inReplyTo":"20060807221914.GA24393@mellanox.co.il","subject":"Re: [PATCH] Multiple refs from the same remote in one git fetch","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2006-08-07T23:05:49Z","receivedAt":"2006-08-07T23:05:49Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"\"Michael S. Tsirkin\" <mst@mellanox.co.il> writes:\n\n> The following seems to fix this issue: simply scan the full\n> refspec list for each remote instead of breaking on the first match.\n> I had to touch the git-fetch.sh script as well as it is scanning\n> the remote list, too. Works for me.\n\nLooks Ok, although I have to admit I just gave a cursory look.\nThanks.\n"},{"id":"25168","messageId":"20060812223947.GA13704@mellanox.co.il","threadId":"5013","inReplyTo":"7vr6zsywmq.fsf@assigned-by-dhcp.cox.net","subject":"Re: [PATCH] Multiple refs from the same remote in one git fetch","fromName":"Michael S. Tsirkin","fromEmail":"mst@mellanox.co.il","sentAt":"2006-08-12T22:39:47Z","receivedAt":"2006-08-12T22:39:47Z","isPatch":true,"sender":{"key":"mst@kernel.org","avatar":null},"body":"Quoting r. Junio C Hamano <junkio@cox.net>:\n> Subject: Re: [PATCH] Multiple refs from the same remote in one git fetch\n> \n> \"Michael S. Tsirkin\" <mst@mellanox.co.il> writes:\n> \n> > The following seems to fix this issue: simply scan the full\n> > refspec list for each remote instead of breaking on the first match.\n> > I had to touch the git-fetch.sh script as well as it is scanning\n> > the remote list, too. Works for me.\n> \n> Looks Ok, although I have to admit I just gave a cursory look.\n> Thanks.\n> \n\nCould this go into next then? \n\n-- \nMST\n"},{"id":"25170","messageId":"7vveoxo8ni.fsf@assigned-by-dhcp.cox.net","threadId":"5013","inReplyTo":"20060812223947.GA13704@mellanox.co.il","subject":"Re: [PATCH] Multiple refs from the same remote in one git fetch","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2006-08-12T23:07:29Z","receivedAt":"2006-08-12T23:07:29Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"\"Michael S. Tsirkin\" <mst@mellanox.co.il> writes:\n\n> Quoting r. Junio C Hamano <junkio@cox.net>:\n>> Subject: Re: [PATCH] Multiple refs from the same remote in one git fetch\n>> \n>> \"Michael S. Tsirkin\" <mst@mellanox.co.il> writes:\n>> \n>> > The following seems to fix this issue: simply scan the full\n>> > refspec list for each remote instead of breaking on the first match.\n>> > I had to touch the git-fetch.sh script as well as it is scanning\n>> > the remote list, too. Works for me.\n>> \n>> Looks Ok, although I have to admit I just gave a cursory look.\n>> Thanks.\n>> \n>\n> Could this go into next then? \n\nNo.  Spoke too fast.  Breaks t6200 test because it reports the\nrefs fetched in duplicates.\n"},{"id":"25201","messageId":"20060814001329.GA24694@mellanox.co.il","threadId":"5013","inReplyTo":"7vveoxo8ni.fsf@assigned-by-dhcp.cox.net","subject":"Re: [PATCH] Multiple refs from the same remote in one git fetch","fromName":"Michael S. Tsirkin","fromEmail":"mst@mellanox.co.il","sentAt":"2006-08-14T00:13:29Z","receivedAt":"2006-08-14T00:13:29Z","isPatch":true,"sender":{"key":"mst@kernel.org","avatar":null},"body":"Quoting r. Junio C Hamano <junkio@cox.net>:\n> >> Looks Ok, although I have to admit I just gave a cursory look.\n> >> Thanks.\n> >> \n> >\n> > Could this go into next then? \n> \n> No.  Spoke too fast.  Breaks t6200 test because it reports the\n> refs fetched in duplicates.\n> \n> \n\nRight, The problem was with the way I coded the loop in git-fetch.sh.\nHere's the fixed versin - seems to pass make test fine.\n\n---\n\nFix git fetch for when multiple refspecs reference the same remote head.\n\nSigned-off-by: Michael S. Tsirkin <mst@mellanox.co.il>\n\n\ndiff --git a/connect.c b/connect.c\nindex 4422a0d..3880191 100644\n--- a/connect.c\n+++ b/connect.c\n@@ -115,6 +115,7 @@ int get_ack(int fd, unsigned char *resul\n int path_match(const char *path, int nr, char **match)\n {\n \tint i;\n+\tint found = 0;\n \tint pathlen = strlen(path);\n \n \tfor (i = 0; i < nr; i++) {\n@@ -128,9 +129,9 @@ int path_match(const char *path, int nr,\n \t\tif (pathlen > len && path[pathlen - len - 1] != '/')\n \t\t\tcontinue;\n \t\t*s = 0;\n-\t\treturn (i + 1);\n+\t\tfound = i + 1;\n \t}\n-\treturn 0;\n+\treturn found;\n }\n \n struct refspec {\ndiff --git a/git-fetch.sh b/git-fetch.sh\nindex c2eebee..80a7a5d 100755\n--- a/git-fetch.sh\n+++ b/git-fetch.sh\n@@ -366,6 +366,7 @@ fetch_main () {\n \t\t  exit 1 ;;\n \t  esac\n \t  found=\n+\t  found_any=\n \t  single_force=\n \t  for ref in $refs\n \t  do\n@@ -373,26 +374,34 @@ fetch_main () {\n \t      +$remote_name:*)\n \t\t  single_force=t\n \t\t  not_for_merge=\n-\t\t  found=\"$ref\"\n-\t\t  break ;;\n+\t\t  found=\"$ref\";;\n \t      .+$remote_name:*)\n \t\t  single_force=t\n \t\t  not_for_merge=t\n-\t\t  found=\"$ref\"\n-\t\t  break ;;\n+\t\t  found=\"$ref\";;\n \t      .$remote_name:*)\n \t\t  not_for_merge=t\n-\t\t  found=\"$ref\"\n-\t\t  break ;;\n+\t\t  found=\"$ref\";;\n \t      $remote_name:*)\n \t\t  not_for_merge=\n-\t\t  found=\"$ref\"\n-\t\t  break ;;\n+\t\t  found=\"$ref\";;\n+\t      *)\n+\t\t  found=;;\n \t      esac\n+\t      if test \"$found\" != \"\"\n+\t      then\n+\t\t  found_any=1\n+\t\t  local_name=$(expr \"z$found\" : 'z[^:]*:\\(.*\\)')\n+\t\t  append_fetch_head \"$sha1\" \"$remote\" \"$remote_name\" \\\n+\t\t      \"$remote_nick\" \"$local_name\" \"$not_for_merge\"\n+\t      fi\n \t  done\n-\t  local_name=$(expr \"z$found\" : 'z[^:]*:\\(.*\\)')\n-\t  append_fetch_head \"$sha1\" \"$remote\" \\\n-\t\t  \"$remote_name\" \"$remote_nick\" \"$local_name\" \"$not_for_merge\"\n+\t  if test \"$found_any\" == \"\"\n+\t  then\n+\t      local_name=$(expr \"z$found\" : 'z[^:]*:\\(.*\\)')\n+\t      append_fetch_head \"$sha1\" \"$remote\" \"$remote_name\" \\\n+\t          \"$remote_nick\" \"$local_name\" \"$not_for_merge\"\n+\t  fi\n       done\n     ) || exit ;;\n   esac\ndiff --git a/t/Makefile b/t/Makefile\n\n-- \nMST\n"},{"id":"25203","messageId":"7vac68i2wv.fsf@assigned-by-dhcp.cox.net","threadId":"5013","inReplyTo":"20060814001329.GA24694@mellanox.co.il","subject":"Re: [PATCH] Multiple refs from the same remote in one git fetch","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2006-08-14T00:20:16Z","receivedAt":"2006-08-14T00:20:16Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"\"Michael S. Tsirkin\" <mst@mellanox.co.il> writes:\n\n>> > Could this go into next then? \n>> \n>> No.  Spoke too fast.  Breaks t6200 test because it reports the\n>> refs fetched in duplicates.\n>\n> Right, The problem was with the way I coded the loop in git-fetch.sh.\n> Here's the fixed versin - seems to pass make test fine.\n\nBut what are you doing for single_force and not_for_merge when\nthere are more than one matches in the patch?  They seem to get\nset to a random value depending on whatever happens to match\nlast, which does not feel quite right.\n"},{"id":"25217","messageId":"20060814051302.GB21963@mellanox.co.il","threadId":"5013","inReplyTo":"7vac68i2wv.fsf@assigned-by-dhcp.cox.net","subject":"Re: [PATCH] Multiple refs from the same remote in one git fetch","fromName":"Michael S. Tsirkin","fromEmail":"mst@mellanox.co.il","sentAt":"2006-08-14T05:13:02Z","receivedAt":"2006-08-14T05:13:02Z","isPatch":true,"sender":{"key":"mst@kernel.org","avatar":null},"body":"Quoting r. Junio C Hamano <junkio@cox.net>:\n> Subject: Re: [PATCH] Multiple refs from the same remote in one git fetch\n> \n> \"Michael S. Tsirkin\" <mst@mellanox.co.il> writes:\n> \n> >> > Could this go into next then? \n> >> \n> >> No.  Spoke too fast.  Breaks t6200 test because it reports the\n> >> refs fetched in duplicates.\n> >\n> > Right, The problem was with the way I coded the loop in git-fetch.sh.\n> > Here's the fixed versin - seems to pass make test fine.\n> \n> But what are you doing for single_force and not_for_merge when\n> there are more than one matches in the patch?  They seem to get\n> set to a random value depending on whatever happens to match\n> last, which does not feel quite right.\n> \n\nI think it was only true for single_force - but here's a patch to fix it and\nalso make this explicit.\n\nBTW, does it still look like it's worth it the effort to lift the restriction,\nor does fixing the error message to something like\n\"no such remote or duplicate ref %s\"\nmake more sense to you?\n\nSigned-off-by: Michael S. Tsirkin <mst@mellanox.co.il>\n\ndiff --git a/connect.c b/connect.c\nindex 4422a0d..3880191 100644\n--- a/connect.c\n+++ b/connect.c\n@@ -115,6 +115,7 @@ int get_ack(int fd, unsigned char *resul\n int path_match(const char *path, int nr, char **match)\n {\n \tint i;\n+\tint found = 0;\n \tint pathlen = strlen(path);\n \n \tfor (i = 0; i < nr; i++) {\n@@ -128,9 +129,9 @@ int path_match(const char *path, int nr,\n \t\tif (pathlen > len && path[pathlen - len - 1] != '/')\n \t\t\tcontinue;\n \t\t*s = 0;\n-\t\treturn (i + 1);\n+\t\tfound = i + 1;\n \t}\n-\treturn 0;\n+\treturn found;\n }\n \n struct refspec {\ndiff --git a/git-fetch.sh b/git-fetch.sh\nindex c2eebee..328168b 100755\n--- a/git-fetch.sh\n+++ b/git-fetch.sh\n@@ -366,33 +366,44 @@ fetch_main () {\n \t\t  exit 1 ;;\n \t  esac\n \t  found=\n-\t  single_force=\n+\t  found_any=\n \t  for ref in $refs\n \t  do\n \t      case \"$ref\" in\n \t      +$remote_name:*)\n \t\t  single_force=t\n \t\t  not_for_merge=\n-\t\t  found=\"$ref\"\n-\t\t  break ;;\n+\t\t  found=\"$ref\";;\n \t      .+$remote_name:*)\n \t\t  single_force=t\n \t\t  not_for_merge=t\n-\t\t  found=\"$ref\"\n-\t\t  break ;;\n+\t\t  found=\"$ref\";;\n \t      .$remote_name:*)\n+\t\t  single_force=\n \t\t  not_for_merge=t\n-\t\t  found=\"$ref\"\n-\t\t  break ;;\n+\t\t  found=\"$ref\";;\n \t      $remote_name:*)\n+\t\t  single_force=\n+\t\t  not_for_merge=\n+\t\t  found=\"$ref\";;\n+\t      *)\n+\t\t  single_force=\n \t\t  not_for_merge=\n-\t\t  found=\"$ref\"\n-\t\t  break ;;\n+\t\t  found=;;\n \t      esac\n+\t      if test \"$found\" != \"\"\n+\t      then\n+\t\t  found_any=1\n+\t\t  local_name=$(expr \"z$found\" : 'z[^:]*:\\(.*\\)')\n+\t\t  append_fetch_head \"$sha1\" \"$remote\" \"$remote_name\" \\\n+\t\t      \"$remote_nick\" \"$local_name\" \"$not_for_merge\"\n+\t      fi\n \t  done\n-\t  local_name=$(expr \"z$found\" : 'z[^:]*:\\(.*\\)')\n-\t  append_fetch_head \"$sha1\" \"$remote\" \\\n-\t\t  \"$remote_name\" \"$remote_nick\" \"$local_name\" \"$not_for_merge\"\n+\t  if test \"$found_any\" == \"\"\n+\t  then\n+\t      append_fetch_head \"$sha1\" \"$remote\" \"$remote_name\" \\\n+\t          \"$remote_nick\" \"\" \"\"\n+\t  fi\n       done\n     ) || exit ;;\n   esac\ndiff --git a/t/Makefile b/t/Makefile\n\n-- \nMST\n"},{"id":"25219","messageId":"7vzme7g8wt.fsf@assigned-by-dhcp.cox.net","threadId":"5013","inReplyTo":"20060814051302.GB21963@mellanox.co.il","subject":"Re: [PATCH] Multiple refs from the same remote in one git fetch","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2006-08-14T05:53:38Z","receivedAt":"2006-08-14T05:53:38Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"\"Michael S. Tsirkin\" <mst@mellanox.co.il> writes:\n\n> BTW, does it still look like it's worth it the effort to lift the restriction,\n> or does fixing the error message to something like\n> \"no such remote or duplicate ref %s\"\n> make more sense to you?\n\nI have been hesitant to claim that it does not make any sense to\nuse more than one tracking branch for the same remote branch,\nbecause the only reason I might say so is because I haven't\nthought of a good usage pattern to do so.\n\nBut apparently you do use more than one local branch to keep\ntrack of one remote branch.  How do you use it for?  Do you feel\nit is a good feature to be able to do that, or do you think it\nis just a mistake and more sensible error message is what we\nwould really want?\n"},{"id":"25224","messageId":"20060814063309.GD21963@mellanox.co.il","threadId":"5013","inReplyTo":"7vzme7g8wt.fsf@assigned-by-dhcp.cox.net","subject":"Re: [PATCH] Multiple refs from the same remote in one git fetch","fromName":"Michael S. Tsirkin","fromEmail":"mst@mellanox.co.il","sentAt":"2006-08-14T06:33:09Z","receivedAt":"2006-08-14T06:33:09Z","isPatch":true,"sender":{"key":"mst@kernel.org","avatar":null},"body":"Quoting r. Junio C Hamano <junkio@cox.net>:\n> Subject: Re: [PATCH] Multiple refs from the same remote in one git fetch\n> \n> \"Michael S. Tsirkin\" <mst@mellanox.co.il> writes:\n> \n> > BTW, does it still look like it's worth it the effort to lift the restriction,\n> > or does fixing the error message to something like\n> > \"no such remote or duplicate ref %s\"\n> > make more sense to you?\n> \n> I have been hesitant to claim that it does not make any sense to\n> use more than one tracking branch for the same remote branch,\n> because the only reason I might say so is because I haven't\n> thought of a good usage pattern to do so.\n> \n> But apparently you do use more than one local branch to keep\n> track of one remote branch.  How do you use it for?  Do you feel\n> it is a good feature to be able to do that, or do you think it\n> is just a mistake and more sensible error message is what we\n> would really want?\n> \n\nWell, what I was *trying* to do is simply add a more descriptive name for\nthe linus master branch to my existing tree.\nSo it seemed like an obvious idea to add\n\nPull: master:origin\nPull: master:linus_master\n\nOn a more theoretical level, in a shared repository development style, one might\nimagine several people who want the branch to be called differently.\nAnother reason might be scripts using specific branch names where you\nmight want to be free to decide where a specific branch name points to.\n\nYea, I still feel it would be a good feature to have - I just wanted to\ncheck there's no opposition to this.\n\n-- \nMST\n"},{"id":"25228","messageId":"7v64gvg48b.fsf@assigned-by-dhcp.cox.net","threadId":"5013","inReplyTo":"20060814063309.GD21963@mellanox.co.il","subject":"Re: [PATCH] Multiple refs from the same remote in one git fetch","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2006-08-14T07:34:44Z","receivedAt":"2006-08-14T07:34:44Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"\"Michael S. Tsirkin\" <mst@mellanox.co.il> writes:\n\n> On a more theoretical level, in a shared repository\n> development style, one might imagine several people who want\n> the branch to be called differently.\n\nA shared repository in git context usually means the repository\n\"everybody pushes into and pulls _from_\".  We are talking about\npulling into a repository -- and even if you are using a shared\nrepository you do not share a repository you pull into.\n\nA shared repository style\" does not mean anarchy; helping to\nname the same thing with multiple branch names at the central\nsite is not something we would want to encourage anyway.\n"},{"id":"25229","messageId":"20060814074236.GG21963@mellanox.co.il","threadId":"5013","inReplyTo":"7v64gvg48b.fsf@assigned-by-dhcp.cox.net","subject":"Re: [PATCH] Multiple refs from the same remote in one git fetch","fromName":"Michael S. Tsirkin","fromEmail":"mst@mellanox.co.il","sentAt":"2006-08-14T07:42:36Z","receivedAt":"2006-08-14T07:42:36Z","isPatch":true,"sender":{"key":"mst@kernel.org","avatar":null},"body":"Quoting r. Junio C Hamano <junkio@cox.net>:\n> A shared repository style\" does not mean anarchy; helping to\n> name the same thing with multiple branch names at the central\n> site is not something we would want to encourage anyway.\n> \n\nOK. Do other reasons sound sufficiently convincing to you?\n\n-- \nMST\n"},{"id":"25248","messageId":"ebpket$7dt$1@sea.gmane.org","threadId":"5013","inReplyTo":"20060814063309.GD21963@mellanox.co.il","subject":"Re: [PATCH] Multiple refs from the same remote in one git fetch","fromName":"Jakub Narebski","fromEmail":"jnareb@gmail.com","sentAt":"2006-08-14T10:49:45Z","receivedAt":"2006-08-14T10:49:45Z","isPatch":true,"sender":{"key":"jnareb@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2706?v=4"},"body":"Michael S. Tsirkin wrote:\n\n> Quoting r. Junio C Hamano <junkio@cox.net>:\n[...]\n>> I have been hesitant to claim that it does not make any sense to\n>> use more than one tracking branch for the same remote branch,\n>> because the only reason I might say so is because I haven't\n>> thought of a good usage pattern to do so.\n>> \n>> But apparently you do use more than one local branch to keep\n>> track of one remote branch.  How do you use it for?  Do you feel\n>> it is a good feature to be able to do that, or do you think it\n>> is just a mistake and more sensible error message is what we\n>> would really want?\n>> \n> \n> Well, what I was *trying* to do is simply add a more descriptive name for\n> the linus master branch to my existing tree.\n> So it seemed like an obvious idea to add\n> \n> Pull: master:origin\n> Pull: master:linus_master\n\nCouldn't you do this via symlinks or symrefs? \n\nBTW. Do we support symrefs other than HEAD, and does reflog works with\nsymref heads, and symlinked heads?\n\n-- \nJakub Narebski\nWarsaw, Poland\nShadeHawk on #git\n"},{"id":"25270","messageId":"20060814175130.GB16821@mellanox.co.il","threadId":"5013","inReplyTo":"ebpket$7dt$1@sea.gmane.org","subject":"Re: [PATCH] Multiple refs from the same remote in one git fetch","fromName":"Michael S. Tsirkin","fromEmail":"mst@mellanox.co.il","sentAt":"2006-08-14T17:51:30Z","receivedAt":"2006-08-14T17:51:30Z","isPatch":true,"sender":{"key":"mst@kernel.org","avatar":null},"body":"Quoting r. Jakub Narebski <jnareb@gmail.com>:\n> Subject: Re: [PATCH] Multiple refs from the same remote in one git fetch\n> \n> Michael S. Tsirkin wrote:\n> \n> > Quoting r. Junio C Hamano <junkio@cox.net>:\n> [...]\n> >> I have been hesitant to claim that it does not make any sense to\n> >> use more than one tracking branch for the same remote branch,\n> >> because the only reason I might say so is because I haven't\n> >> thought of a good usage pattern to do so.\n> >> \n> >> But apparently you do use more than one local branch to keep\n> >> track of one remote branch.  How do you use it for?  Do you feel\n> >> it is a good feature to be able to do that, or do you think it\n> >> is just a mistake and more sensible error message is what we\n> >> would really want?\n> >> \n> > \n> > Well, what I was *trying* to do is simply add a more descriptive name for\n> > the linus master branch to my existing tree.\n> > So it seemed like an obvious idea to add\n> > \n> > Pull: master:origin\n> > Pull: master:linus_master\n> \n> Couldn't you do this via symlinks or symrefs? \n> \n> BTW. Do we support symrefs other than HEAD, and does reflog works with\n> symref heads, and symlinked heads?\n\nHow?\n\n-- \nMST\n"},{"id":"25273","messageId":"ebqfjq$ujd$1@sea.gmane.org","threadId":"5013","inReplyTo":"20060814175130.GB16821@mellanox.co.il","subject":"Re: [PATCH] Multiple refs from the same remote in one git fetch","fromName":"Jakub Narebski","fromEmail":"jnareb@gmail.com","sentAt":"2006-08-14T18:33:11Z","receivedAt":"2006-08-14T18:33:11Z","isPatch":true,"sender":{"key":"jnareb@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2706?v=4"},"body":"Michael S. Tsirkin wrote:\n\n>>> Well, what I was *trying* to do is simply add a more descriptive name\n>>> for the linus master branch to my existing tree.\n>>>\n>>> So it seemed like an obvious idea to add\n>>> \n>>> Pull: master:origin\n>>> Pull: master:linus_master\n>> \n>> Couldn't you do this via symlinks or symrefs? \n>> \n>> BTW. Do we support symrefs other than HEAD, and does reflog works with\n>> symref heads, and symlinked heads?\n> \n> How?\n\nHave only \"Pull: master:linus_master\" as the pull line, and make origin\nsymlink (ln -s $GIT_DIR/refs/heads/linus_master $GIT_DIR/refs/heads/origin)\nor symref (echo \"ref: refs/heads/linus_master\" > $GIT_DIR/refs/heads/origin)\nor vice versa.\n\n-- \nJakub Narebski\nWarsaw, Poland\nShadeHawk on #git\n"},{"id":"25277","messageId":"20060814191733.GD16821@mellanox.co.il","threadId":"5013","inReplyTo":"ebqfjq$ujd$1@sea.gmane.org","subject":"Re: [PATCH] Multiple refs from the same remote in one git fetch","fromName":"Michael S. Tsirkin","fromEmail":"mst@mellanox.co.il","sentAt":"2006-08-14T19:17:33Z","receivedAt":"2006-08-14T19:17:33Z","isPatch":true,"sender":{"key":"mst@kernel.org","avatar":null},"body":"\nQuoting r. Jakub Narebski <jnareb@gmail.com>:\n> Have only \"Pull: master:linus_master\" as the pull line, and make origin\n> symlink (ln -s $GIT_DIR/refs/heads/linus_master $GIT_DIR/refs/heads/origin)\n> or symref (echo \"ref: refs/heads/linus_master\" > $GIT_DIR/refs/heads/origin)\n> or vice versa.\n\nThanks.\n\n-- \nMST\n"},{"id":"25751","messageId":"20060822151029.GA19247@mellanox.co.il","threadId":"5013","inReplyTo":"20060814051302.GB21963@mellanox.co.il","subject":"[PATCH repost] Multiple refs from the same remote in one git fetch","fromName":"Michael S. Tsirkin","fromEmail":"mst@mellanox.co.il","sentAt":"2006-08-22T15:10:29Z","receivedAt":"2006-08-22T15:10:29Z","isPatch":true,"sender":{"key":"mst@kernel.org","avatar":null},"body":"Hi, Junio!\nIs the following likely to get merged eventually?\nIt was pointed out that I can work-around the limitation\nby using softlinks, so it's not a show-stopper for me.\n\n---\n\nFix git fetch for when multiple refspecs reference the same remote head.\n\nSigned-off-by: Michael S. Tsirkin <mst@mellanox.co.il>\n\ndiff --git a/connect.c b/connect.c\nindex 4422a0d..3880191 100644\n--- a/connect.c\n+++ b/connect.c\n@@ -115,6 +115,7 @@ int get_ack(int fd, unsigned char *resul\n int path_match(const char *path, int nr, char **match)\n {\n \tint i;\n+\tint found = 0;\n \tint pathlen = strlen(path);\n \n \tfor (i = 0; i < nr; i++) {\n@@ -128,9 +129,9 @@ int path_match(const char *path, int nr,\n \t\tif (pathlen > len && path[pathlen - len - 1] != '/')\n \t\t\tcontinue;\n \t\t*s = 0;\n-\t\treturn (i + 1);\n+\t\tfound = i + 1;\n \t}\n-\treturn 0;\n+\treturn found;\n }\n \n struct refspec {\ndiff --git a/git-fetch.sh b/git-fetch.sh\nindex c2eebee..328168b 100755\n--- a/git-fetch.sh\n+++ b/git-fetch.sh\n@@ -366,33 +366,44 @@ fetch_main () {\n \t\t  exit 1 ;;\n \t  esac\n \t  found=\n-\t  single_force=\n+\t  found_any=\n \t  for ref in $refs\n \t  do\n \t      case \"$ref\" in\n \t      +$remote_name:*)\n \t\t  single_force=t\n \t\t  not_for_merge=\n-\t\t  found=\"$ref\"\n-\t\t  break ;;\n+\t\t  found=\"$ref\";;\n \t      .+$remote_name:*)\n \t\t  single_force=t\n \t\t  not_for_merge=t\n-\t\t  found=\"$ref\"\n-\t\t  break ;;\n+\t\t  found=\"$ref\";;\n \t      .$remote_name:*)\n+\t\t  single_force=\n \t\t  not_for_merge=t\n-\t\t  found=\"$ref\"\n-\t\t  break ;;\n+\t\t  found=\"$ref\";;\n \t      $remote_name:*)\n+\t\t  single_force=\n+\t\t  not_for_merge=\n+\t\t  found=\"$ref\";;\n+\t      *)\n+\t\t  single_force=\n \t\t  not_for_merge=\n-\t\t  found=\"$ref\"\n-\t\t  break ;;\n+\t\t  found=;;\n \t      esac\n+\t      if test \"$found\" != \"\"\n+\t      then\n+\t\t  found_any=1\n+\t\t  local_name=$(expr \"z$found\" : 'z[^:]*:\\(.*\\)')\n+\t\t  append_fetch_head \"$sha1\" \"$remote\" \"$remote_name\" \\\n+\t\t      \"$remote_nick\" \"$local_name\" \"$not_for_merge\"\n+\t      fi\n \t  done\n-\t  local_name=$(expr \"z$found\" : 'z[^:]*:\\(.*\\)')\n-\t  append_fetch_head \"$sha1\" \"$remote\" \\\n-\t\t  \"$remote_name\" \"$remote_nick\" \"$local_name\" \"$not_for_merge\"\n+\t  if test \"$found_any\" == \"\"\n+\t  then\n+\t      append_fetch_head \"$sha1\" \"$remote\" \"$remote_name\" \\\n+\t          \"$remote_nick\" \"\" \"\"\n+\t  fi\n       done\n     ) || exit ;;\n   esac\n\n-- \nMST\n"},{"id":"25777","messageId":"7v7j10jkuy.fsf@assigned-by-dhcp.cox.net","threadId":"5013","inReplyTo":"20060822151029.GA19247@mellanox.co.il","subject":"Re: [PATCH repost] Multiple refs from the same remote in one git fetch","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2006-08-23T01:34:29Z","receivedAt":"2006-08-23T01:34:29Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Although this round does not seem to break tests like before, I\nstill do not see a valid use case for it.  So...\n"}]}