{"thread":{"id":"3211","subject":"[PATCH] git-svnimport.perl: fix for 'arg list too long...'","startedAt":"2006-02-01T15:53:31Z","lastAt":"2006-02-02T14:26:38Z","messageCount":6,"participants":["Sasha Khapyorsky","Junio C Hamano","Matthias Urlichs"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"15404","messageId":"20060201155331.GE18078@sashak.voltaire.com","threadId":"3211","inReplyTo":null,"subject":"[PATCH] git-svnimport.perl: fix for 'arg list too long...'","fromName":"Sasha Khapyorsky","fromEmail":"sashak@voltaire.com","sentAt":"2006-02-01T15:53:31Z","receivedAt":"2006-02-01T15:53:31Z","isPatch":true,"sender":{"key":"sashak@voltaire.com","avatar":null},"body":"Hello,\n\nThis fixes 'arg list too long' problem when passed to git-ls-files.\n\nSasha.\n\n\nThis fixes 'arg list too long..' problem with git-ls-files.\n\nNote that second arg list separation loop (with 'git-update-index') is\nneeded since git-ls-files arguments can be directories.\n\nSigned-off-by: Sasha Khapyorsky <sashak@voltaire.com>\n\ndiff --git a/git-svnimport.perl b/git-svnimport.perl\nindex 6e3a44a..b6799d8 100755\n--- a/git-svnimport.perl\n+++ b/git-svnimport.perl\n@@ -546,23 +546,30 @@ sub commit {\n \t\t\t}\n \t\t}\n \n-\t\tif(@old) {\n-\t\t\topen my $F, \"-|\", \"git-ls-files\", \"-z\", @old or die $!;\n-\t\t\t@old = ();\n+\t\twhile(@old) {\n+\t\t\tmy @o1;\n+\t\t\tif(@old > 55) {\n+\t\t\t\t@o1 = splice(@old,0,50);\n+\t\t\t} else {\n+\t\t\t\t@o1 = @old;\n+\t\t\t\t@old = ();\n+\t\t\t}\n+\t\t\topen my $F, \"-|\", \"git-ls-files\", \"-z\", @o1 or die $!;\n+\t\t\t@o1 = ();\n \t\t\tlocal $/ = \"\\0\";\n \t\t\twhile(<$F>) {\n \t\t\t\tchomp;\n-\t\t\t\tpush(@old,$_);\n+\t\t\t\tpush(@o1,$_);\n \t\t\t}\n \t\t\tclose($F);\n \n-\t\t\twhile(@old) {\n+\t\t\twhile(@o1) {\n \t\t\t\tmy @o2;\n-\t\t\t\tif(@old > 55) {\n-\t\t\t\t\t@o2 = splice(@old,0,50);\n+\t\t\t\tif(@o1 > 55) {\n+\t\t\t\t\t@o2 = splice(@o1,0,50);\n \t\t\t\t} else {\n-\t\t\t\t\t@o2 = @old;\n-\t\t\t\t\t@old = ();\n+\t\t\t\t\t@o2 = @o1;\n+\t\t\t\t\t@o1 = ();\n \t\t\t\t}\n \t\t\t\tsystem(\"git-update-index\",\"--force-remove\",\"--\",@o2);\n \t\t\t\tdie \"Cannot remove files: $?\\n\" if $?;\n"},{"id":"15422","messageId":"7v64nybz9m.fsf@assigned-by-dhcp.cox.net","threadId":"3211","inReplyTo":"20060201155331.GE18078@sashak.voltaire.com","subject":"Re: [PATCH] git-svnimport.perl: fix for 'arg list too long...'","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2006-02-01T20:27:33Z","receivedAt":"2006-02-01T20:27:33Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Sasha Khapyorsky <sashak@voltaire.com> writes:\n\n> This fixes 'arg list too long..' problem with git-ls-files.\n\nI wonder if feeding the list into a pipe to 'update-index --stdin' \nwould be an option.\n\nBTW, please do not do this:\n\n        Mail-Followup-To: Junio C Hamano <junkio@cox.net>,\n                Matthias Urlichs <smurf@smurf.noris.de>, git@vger.kernel.org\n\nIt is simply rude.\n\n * I and/or Smurf may be uninterested in hearing the whole\n   discussion thread started by you.  We might well be, but that\n   is not something you shoudl decide upfront in your message.\n\n * When a recipient of your message tries to \"[R]eply\" to *you*,\n   that Mail-Followup-To: would cause the MUA to address that\n   message to me and/or smurf by default, not to you.  I had to\n   edit the resulting To: header by hand to address this\n   response to you.  Why force extra work on others?\n\nI know why you did it --- you subscribe to git list and\notherwise you would get two copies.\n\nThat is _not_ a good excuse.  That is how mailing lists work;\neither you filter the duplicates on your end, or you learn to\nlive with it.  Please don't force extra work on others.\n\nI think the only header mucking of this kind that is acceptable\nis to remove yourself from CC: line when the mailing list you\nsubscribe to is already on the CC: line.\n"},{"id":"15435","messageId":"20060201215454.GB31711@sashak.voltaire.com","threadId":"3211","inReplyTo":"7v64nybz9m.fsf@assigned-by-dhcp.cox.net","subject":"Re: [PATCH] git-svnimport.perl: fix for 'arg list too long...'","fromName":"Sasha Khapyorsky","fromEmail":"sashak@voltaire.com","sentAt":"2006-02-01T21:54:54Z","receivedAt":"2006-02-01T21:54:54Z","isPatch":true,"sender":{"key":"sashak@voltaire.com","avatar":null},"body":"On 12:27 Wed 01 Feb     , Junio C Hamano wrote:\n> Sasha Khapyorsky <sashak@voltaire.com> writes:\n> \n> > This fixes 'arg list too long..' problem with git-ls-files.\n> \n> I wonder if feeding the list into a pipe to 'update-index --stdin' \n> would be an option.\n\nThis can be option for git-update-index, but my problem was with\ngit-ls-files, git-update-index was ok (arg list processing were splitted\nalready).\n\n> \n> BTW, please do not do this:\n> \n>         Mail-Followup-To: Junio C Hamano <junkio@cox.net>,\n>                 Matthias Urlichs <smurf@smurf.noris.de>, git@vger.kernel.org\n> \n> It is simply rude.\n\nOK, will not. Thanks for pointing.\n\nSasha.\n"},{"id":"15441","messageId":"7v3bj27kxe.fsf@assigned-by-dhcp.cox.net","threadId":"3211","inReplyTo":"20060201215454.GB31711@sashak.voltaire.com","subject":"Re: [PATCH] git-svnimport.perl: fix for 'arg list too long...'","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2006-02-01T22:50:53Z","receivedAt":"2006-02-01T22:50:53Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Sasha Khapyorsky <sashak@voltaire.com> writes:\n\n> On 12:27 Wed 01 Feb     , Junio C Hamano wrote:\n>> Sasha Khapyorsky <sashak@voltaire.com> writes:\n>> \n>> > This fixes 'arg list too long..' problem with git-ls-files.\n>> \n>> I wonder if feeding the list into a pipe to 'update-index --stdin' \n>> would be an option.\n>\n> This can be option for git-update-index, but my problem was with\n> git-ls-files, git-update-index was ok (arg list processing were splitted\n> already).\n\nI was commenting on the \"while (@o1)\" loop that splices at 50\nwhen the list has more than 55 items to feed update-index.  You\ncould accumulate output from multiple invocations of ls-files\nand feed everything to a single \"update-index --stdin\" after the\n\"while (@old)\" loop is done.  Batch of 50 vs a single batch may\nnot matter though [*1*].\n\nBut you are right; that git-ls-files can get too many arguments\nunless you split like that.\n\nA casual skimming over the rest of the code tells me that this\nfixes the last instance of such a command invocation with too\nmany arguments.  Good catch.\n\nSmurf, I do not have problems with Sasha's patch.  Are you OK\nif I apply it?\n\n\n-- >8 --\n\n*1* I do not think this makes much of a difference but here is what\nI mean.\n\ndiff --git a/git-svnimport.perl b/git-svnimport.perl\nindex b6799d8..d76a595 100755\n--- a/git-svnimport.perl\n+++ b/git-svnimport.perl\n@@ -546,7 +546,8 @@ sub commit {\n \t\t\t}\n \t\t}\n \n-\t\twhile(@old) {\n+\t\tmy @u = ();\n+\t\twhile (@old) {\n \t\t\tmy @o1;\n \t\t\tif(@old > 55) {\n \t\t\t\t@o1 = splice(@old,0,50);\n@@ -555,26 +556,19 @@ sub commit {\n \t\t\t\t@old = ();\n \t\t\t}\n \t\t\topen my $F, \"-|\", \"git-ls-files\", \"-z\", @o1 or die $!;\n-\t\t\t@o1 = ();\n \t\t\tlocal $/ = \"\\0\";\n \t\t\twhile(<$F>) {\n \t\t\t\tchomp;\n-\t\t\t\tpush(@o1,$_);\n+\t\t\t\tpush(@u,$_);\n \t\t\t}\n \t\t\tclose($F);\n-\n-\t\t\twhile(@o1) {\n-\t\t\t\tmy @o2;\n-\t\t\t\tif(@o1 > 55) {\n-\t\t\t\t\t@o2 = splice(@o1,0,50);\n-\t\t\t\t} else {\n-\t\t\t\t\t@o2 = @o1;\n-\t\t\t\t\t@o1 = ();\n-\t\t\t\t}\n-\t\t\t\tsystem(\"git-update-index\",\"--force-remove\",\"--\",@o2);\n-\t\t\t\tdie \"Cannot remove files: $?\\n\" if $?;\n-\t\t\t}\n \t\t}\n+\t\topen my $F, \"|-\",\n+\t\t\tqw(git-update-index --force-remove -z --stdin)\n+\t\t\t\tor die $!;\n+\t\tprint $F \"$_\\0\" for @u;\n+\t\tclose $F or die $!;\n+\n \t\twhile(@new) {\n \t\t\tmy @n2;\n \t\t\tif(@new > 12) {\n"},{"id":"15450","messageId":"20060201235020.GC6135@kiste.smurf.noris.de","threadId":"3211","inReplyTo":"7v3bj27kxe.fsf@assigned-by-dhcp.cox.net","subject":"Re: [PATCH] git-svnimport.perl: fix for 'arg list too long...'","fromName":"Matthias Urlichs","fromEmail":"smurf@smurf.noris.de","sentAt":"2006-02-01T23:50:20Z","receivedAt":"2006-02-01T23:50:20Z","isPatch":true,"sender":{"key":"matthias@urlichs.de","avatar":"https://gravatar.com/avatar/2708905af227313eba6f2b2ae0f7d0259b5ac5d71baef58fe5a13c699ce0bbf0?d=mp&s=160"},"body":"Hi,\n\nJunio C Hamano:\n> Smurf, I do not have problems with Sasha's patch.  Are you OK\n> if I apply it?\n> \nGo ahead.\n\n-- \nMatthias Urlichs   |   {M:U} IT Design @ m-u-it.de   |  smurf@smurf.noris.de\nDisclaimer: The quote was selected randomly. Really. | http://smurf.noris.de\n - -\nCircumstances can force a generalized incompetent to become competent, at\nleast in a specialized field.\n\t\t\t\t\t-- Frank R. Freemon\n"},{"id":"15489","messageId":"20060202142638.GD32188@sashak.voltaire.com","threadId":"3211","inReplyTo":"7v3bj27kxe.fsf@assigned-by-dhcp.cox.net","subject":"Re: [PATCH] git-svnimport.perl: fix for 'arg list too long...'","fromName":"Sasha Khapyorsky","fromEmail":"sashak@voltaire.com","sentAt":"2006-02-02T14:26:38Z","receivedAt":"2006-02-02T14:26:38Z","isPatch":true,"sender":{"key":"sashak@voltaire.com","avatar":null},"body":"On 14:50 Wed 01 Feb     , Junio C Hamano wrote:\n> \n> *1* I do not think this makes much of a difference but here is what\n> I mean.\n> \n> diff --git a/git-svnimport.perl b/git-svnimport.perl\n\nTested. Works good. I think your version is cleaner. Cosmetic comment btw:\n\n> +\t\topen my $F, \"|-\",\n> +\t\t\tqw(git-update-index --force-remove -z --stdin)\n> +\t\t\t\tor die $!;\n> +\t\tprint $F \"$_\\0\" for @u;\n> +\t\tclose $F or die $!;\n\nIt is not critical, but this block may be under if(@u) {..} to prevent\n\"empty\" git-update-index invocations.\n\nSasha.\n"}]}