{"thread":{"id":"4649","subject":"[PATCH] cvsimport: setup indexes correctly for ancestors and incremental imports","startedAt":"2006-06-24T11:13:08Z","lastAt":"2006-06-25T09:27:30Z","messageCount":7,"participants":["Martin Langhoff","Sergey Vlasov","Johannes Schindelin","Junio C Hamano","Petr Baudis"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"22435","messageId":"11511475882820-git-send-email-martin@catalyst.net.nz","threadId":"4649","inReplyTo":null,"subject":"[PATCH] cvsimport: setup indexes correctly for ancestors and incremental imports","fromName":"Martin Langhoff","fromEmail":"martin@catalyst.net.nz","sentAt":"2006-06-24T11:13:08Z","receivedAt":"2006-06-24T11:13:08Z","isPatch":true,"sender":{"key":"martin@laptop.org","avatar":null},"body":"Two bugs had slipped in the \"keep one index per branch during import\"\npatch. Both incremental imports and new branches would see an\nempty tree for their initial commit. Now we cover all the relevant\ncases, checking whether we actually need to setup the index before\npreparing the actual commit, and doing it.\n\nSigned-off-by: Martin Langhoff <martin@catalyst.net.nz>\n\n---\n git-cvsimport.perl |   19 +++++++++++++++++--\n 1 files changed, 17 insertions(+), 2 deletions(-)\n\ndiff --git a/git-cvsimport.perl b/git-cvsimport.perl\nold mode 100644\nnew mode 100755\nindex d961b7b..1c1fd02\n--- a/git-cvsimport.perl\n+++ b/git-cvsimport.perl\n@@ -813,11 +813,26 @@ while(<CVS>) {\n \t\t\tunless ($index{$branch}) {\n \t\t\t    $index{$branch} = tmpnam();\n \t\t\t    $ENV{GIT_INDEX_FILE} = $index{$branch};\n-\t\t\t    system(\"git-read-tree\", $branch);\n+\t\t\t}\n+\t\t\tif ($ancestor) {\n+\t\t\t    system(\"git-read-tree\", $ancestor);\n \t\t\t    die \"read-tree failed: $?\\n\" if $?;\n \t\t\t} else {\n+\t\t\t    unless ($index{$branch}) {\n+\t\t\t\t$index{$branch} = tmpnam();\n+\t\t\t\t$ENV{GIT_INDEX_FILE} = $index{$branch};\n+\t\t\t\tsystem(\"git-read-tree\", $branch);\n+\t\t\t\tdie \"read-tree failed: $?\\n\" if $?;\n+\t\t\t    }\n+\t\t\t}    \n+\t\t} else {\n+\t\t\t# just in case\n+\t\t\tunless ($index{$branch}) {\n+\t\t\t    $index{$branch} = tmpnam();\n \t\t\t    $ENV{GIT_INDEX_FILE} = $index{$branch};\n-\t\t        }\n+\t\t\t    system(\"git-read-tree\", $branch);\n+\t\t\t    die \"read-tree failed: $?\\n\" if $?;\n+\t\t\t}\n \t\t}\n \t\t$last_branch = $branch if $branch ne $last_branch;\n \t\t$state = 9;\n-- \n1.4.1.rc1.g59c8\n"},{"id":"22449","messageId":"20060624170638.6f127420.vsu@altlinux.ru","threadId":"4649","inReplyTo":"11511475882820-git-send-email-martin@catalyst.net.nz","subject":"Re: [PATCH] cvsimport: setup indexes correctly for ancestors and incremental imports","fromName":"Sergey Vlasov","fromEmail":"vsu@altlinux.ru","sentAt":"2006-06-24T13:06:38Z","receivedAt":"2006-06-24T13:06:38Z","isPatch":true,"sender":{"key":"vsu@altlinux.ru","avatar":"https://avatars.githubusercontent.com/u/616082?v=4"},"body":"On Sat, 24 Jun 2006 23:13:08 +1200 Martin Langhoff wrote:\n\n> Two bugs had slipped in the \"keep one index per branch during import\"\n> patch. Both incremental imports and new branches would see an\n> empty tree for their initial commit. Now we cover all the relevant\n> cases, checking whether we actually need to setup the index before\n> preparing the actual commit, and doing it.\n> \n> Signed-off-by: Martin Langhoff <martin@catalyst.net.nz>\n> \n> ---\n>  git-cvsimport.perl |   19 +++++++++++++++++--\n>  1 files changed, 17 insertions(+), 2 deletions(-)\n> \n> diff --git a/git-cvsimport.perl b/git-cvsimport.perl\n> old mode 100644\n> new mode 100755\n> index d961b7b..1c1fd02\n> --- a/git-cvsimport.perl\n> +++ b/git-cvsimport.perl\n> @@ -813,11 +813,26 @@ while(<CVS>) {\n>  \t\t\tunless ($index{$branch}) {\n>  \t\t\t    $index{$branch} = tmpnam();\n>  \t\t\t    $ENV{GIT_INDEX_FILE} = $index{$branch};\n> -\t\t\t    system(\"git-read-tree\", $branch);\n> +\t\t\t}\n> +\t\t\tif ($ancestor) {\n> +\t\t\t    system(\"git-read-tree\", $ancestor);\n>  \t\t\t    die \"read-tree failed: $?\\n\" if $?;\n>  \t\t\t} else {\n> +\t\t\t    unless ($index{$branch}) {\n\nThis seems to be dead code - even if $index{$branch} was not set, it\nwill be set inside \"unless ($index{$branch})\" above.  Or there is\nanother bug here?\n\n> +\t\t\t\t$index{$branch} = tmpnam();\n> +\t\t\t\t$ENV{GIT_INDEX_FILE} = $index{$branch};\n> +\t\t\t\tsystem(\"git-read-tree\", $branch);\n> +\t\t\t\tdie \"read-tree failed: $?\\n\" if $?;\n> +\t\t\t    }\n> +\t\t\t}    \n> +\t\t} else {\n> +\t\t\t# just in case\n> +\t\t\tunless ($index{$branch}) {\n> +\t\t\t    $index{$branch} = tmpnam();\n>  \t\t\t    $ENV{GIT_INDEX_FILE} = $index{$branch};\n> -\t\t        }\n> +\t\t\t    system(\"git-read-tree\", $branch);\n> +\t\t\t    die \"read-tree failed: $?\\n\" if $?;\n> +\t\t\t}\n>  \t\t}\n>  \t\t$last_branch = $branch if $branch ne $last_branch;\n>  \t\t$state = 9;\n"},{"id":"22471","messageId":"Pine.LNX.4.63.0606242111250.29667@wbgn013.biozentrum.uni-wuerzburg.de","threadId":"4649","inReplyTo":"11511475882820-git-send-email-martin@catalyst.net.nz","subject":"Re: [PATCH] cvsimport: setup indexes correctly for ancestors and incremental imports","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2006-06-24T19:42:20Z","receivedAt":"2006-06-24T19:42:20Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi,\n\nalmost happy.\n\nOn Sat, 24 Jun 2006, Martin Langhoff wrote:\n\n>  \t\t\tunless ($index{$branch}) {\n>  \t\t\t    $index{$branch} = tmpnam();\n>  \t\t\t    $ENV{GIT_INDEX_FILE} = $index{$branch};\n> -\t\t\t    system(\"git-read-tree\", $branch);\n> +\t\t\t}\n> +\t\t\tif ($ancestor) {\n> +\t\t\t    system(\"git-read-tree\", $ancestor);\n>  \t\t\t    die \"read-tree failed: $?\\n\" if $?;\n>  \t\t\t} else {\n> +\t\t\t    unless ($index{$branch}) {\n> +\t\t\t\t$index{$branch} = tmpnam();\n> +\t\t\t\t$ENV{GIT_INDEX_FILE} = $index{$branch};\n> +\t\t\t\tsystem(\"git-read-tree\", $branch);\n> +\t\t\t\tdie \"read-tree failed: $?\\n\" if $?;\n> +\t\t\t    }\n> +\t\t\t}    \n\nThis line ^ seems to have white space at the end.\n\nAlso, in my case, this is still broken. $index{$branch} is set, $ancestor \nnot, but $ENV{GIT_INDEX_FILE} ne $index{$branch}.\n\nYou can reproduce this by importing into branch origin while branch master \n(which is not equal to origin) is checked out.\n\nPlus, the initial setting of GIT_INDEX_FILE forgot to perform a \ngit-read-tree.\n\nHow about this on top of your patch (which fixes things with my setup):\n\n---\n[PATCH] cvsimport: always set $ENV{GIT_INDEX_FILE} to $index{$branch}\n\nAlso, make sure that the initial git-read-tree is performed.\n\nSigned-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>\n\n---\n\n git-cvsimport |   15 ++++++++-------\n 1 files changed, 8 insertions(+), 7 deletions(-)\n\n--- git-cvsimport.perl\t2006-06-24 20:30:33.000000000 +0200\n+++ git-cvsimport\t2006-06-24 21:35:42.000000000 +0200\n@@ -470,6 +470,9 @@\n $index{$opt_o} = tmpnam();\n \n $ENV{GIT_INDEX_FILE} = $index{$opt_o};\n+system(\"git-read-tree\", $opt_o);\n+die \"read-tree failed: $?\\n\" if $?;\n+\n unless(-d $git_dir) {\n \tsystem(\"git-init-db\");\n \tdie \"Cannot init the GIT db at $git_tree: $?\\n\" if $?;\n@@ -813,17 +816,15 @@\n \t\t\tunless ($index{$branch}) {\n \t\t\t    $index{$branch} = tmpnam();\n \t\t\t    $ENV{GIT_INDEX_FILE} = $index{$branch};\n+\t\t\t    system(\"git-read-tree\", $branch);\n+\t\t\t    die \"read-tree failed: $?\\n\" if $?;\n \t\t\t}\n+\t\t\t# just in case\n+\t\t\t$ENV{GIT_INDEX_FILE} = $index{$branch};\n \t\t\tif ($ancestor) {\n+\t\t\t    print \"have ancestor $ancestor\" if $opt_v;\n \t\t\t    system(\"git-read-tree\", $ancestor);\n \t\t\t    die \"read-tree failed: $?\\n\" if $?;\n-\t\t\t} else {\n-\t\t\t    unless ($index{$branch}) {\n-\t\t\t\t$index{$branch} = tmpnam();\n-\t\t\t\t$ENV{GIT_INDEX_FILE} = $index{$branch};\n-\t\t\t\tsystem(\"git-read-tree\", $branch);\n-\t\t\t\tdie \"read-tree failed: $?\\n\" if $?;\n-\t\t\t    }\n \t\t\t}\n \t\t} else {\n \t\t\t# just in case\n"},{"id":"22513","messageId":"7v64iqq6ab.fsf@assigned-by-dhcp.cox.net","threadId":"4649","inReplyTo":"Pine.LNX.4.63.0606242111250.29667@wbgn013.biozentrum.uni-wuerzburg.de","subject":"Re: [PATCH] cvsimport: setup indexes correctly for ancestors and incremental imports","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2006-06-25T03:10:36Z","receivedAt":"2006-06-25T03:10:36Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:\n\n> How about this on top of your patch (which fixes things with my setup):\n>\n> ---\n> [PATCH] cvsimport: always set $ENV{GIT_INDEX_FILE} to $index{$branch}\n>\n> Also, make sure that the initial git-read-tree is performed.\n>\n> Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>\n>\n> ---\n\nPlease please please do not use --- between the cover letter and\ncommit message body if you choose to do the cover letter first.\n\nSuperficial look tells me this would be OK, so it will go to\n\"next\".  Please fix things up as needed and let's have this in\nupcoming 1.4.1 whenever that happens.\n"},{"id":"22526","messageId":"20060625085359.GC21864@pasky.or.cz","threadId":"4649","inReplyTo":"7v64iqq6ab.fsf@assigned-by-dhcp.cox.net","subject":"Re: [PATCH] cvsimport: setup indexes correctly for ancestors and incremental imports","fromName":"Petr Baudis","fromEmail":"pasky@suse.cz","sentAt":"2006-06-25T08:53:59Z","receivedAt":"2006-06-25T08:53:59Z","isPatch":true,"sender":{"key":"pasky@ucw.cz","avatar":"https://avatars.githubusercontent.com/u/18439?v=4"},"body":"Dear diary, on Sun, Jun 25, 2006 at 05:10:36AM CEST, I got a letter\nwhere Junio C Hamano <junkio@cox.net> said that...\n> Please please please do not use --- between the cover letter and\n> commit message body if you choose to do the cover letter first.\n\nOops, I suspect that I'm a huge offender in this regard in that case.\nCan I format my patch mails so that they look like natural replies _and_\nyou can still apply them easily?\n\n-- \n\t\t\t\tPetr \"Pasky\" Baudis\nStuff: http://pasky.or.cz/\nA person is just about as big as the things that make them angry.\n"},{"id":"22528","messageId":"Pine.LNX.4.63.0606251125330.29667@wbgn013.biozentrum.uni-wuerzburg.de","threadId":"4649","inReplyTo":"7v64iqq6ab.fsf@assigned-by-dhcp.cox.net","subject":"Re: [PATCH] cvsimport: setup indexes correctly for ancestors and incremental imports","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2006-06-25T09:26:13Z","receivedAt":"2006-06-25T09:26:13Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi,\n\nOn Sat, 24 Jun 2006, Junio C Hamano wrote:\n\n> Please please please do not use --- between the cover letter and commit \n> message body if you choose to do the cover letter first.\n\nSorry. Will not happen again.\n\nCiao,\nDscho\n"},{"id":"22530","messageId":"7v4py9y48t.fsf@assigned-by-dhcp.cox.net","threadId":"4649","inReplyTo":"20060625085359.GC21864@pasky.or.cz","subject":"Re: [PATCH] cvsimport: setup indexes correctly for ancestors and incremental imports","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2006-06-25T09:27:30Z","receivedAt":"2006-06-25T09:27:30Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Petr Baudis <pasky@suse.cz> writes:\n\n> Dear diary, on Sun, Jun 25, 2006 at 05:10:36AM CEST, I got a letter\n> where Junio C Hamano <junkio@cox.net> said that...\n>> Please please please do not use --- between the cover letter and\n>> commit message body if you choose to do the cover letter first.\n>\n> Oops, I suspect that I'm a huge offender in this regard in that case.\n> Can I format my patch mails so that they look like natural replies _and_\n> you can still apply them easily?\n\nIt's not a big deal.\n\nI do it with scissors mark \"-- >8 --\" because I can use \"git-am\"\nwhile still in GNUS with '|' (gnus-summary-pipe-output) on the\nmessage, and immediately after that I can amend the commit with\n\"git-commit --amend\" to remove everything up to the scissors\nmark.\n\nIf you have --- then I have to save the message in a separate\nfile with 'C-o' (gnus-summary-save-article-mail), open the file\nand remove up to that first --- in the editor, and then run\ngit-am on the file.\n\nOnly when the cover letter is short, I'd prefer Linus style,\nwhich places cover letter material after the --- and the\ndiffstat, although that makes the message like top-posting.\n"}]}