{"thread":{"id":"20721","subject":"[PATCH v2] import-tars: Allow per-tar author and commit message.","startedAt":"2009-08-24T17:55:32Z","lastAt":"2009-08-24T17:55:32Z","messageCount":1,"participants":["Peter Krefting"],"isPatch":true,"patchVersion":2,"patchTotal":null},"messages":[{"id":"121655","messageId":"20090824175740.71AE22FC20@perkele","threadId":"20721","inReplyTo":null,"subject":"[PATCH v2] import-tars: Allow per-tar author and commit message.","fromName":"Peter Krefting","fromEmail":"peter@softwolves.pp.se","sentAt":"2009-08-24T17:55:32Z","receivedAt":"2009-08-24T17:55:32Z","isPatch":true,"sender":{"key":"peter@softwolves.pp.se","avatar":"https://avatars.githubusercontent.com/u/990764?v=4"},"body":"Instead of having each imported tar ball's commit message be \"Imported\nfrom filename.tar\", optionally take a commit message from a file\ncalled \"filename.tar.msg\". The author and committer of the tar ball\ncan also be overridden by embedding an \"Author:\" or \"Committer:\" header\nin the .msg file.\n\nSigned-off-by: Peter Krefting <peter@softwolves.pp.se>\n---\nInstead of having a .author and .committer file to override the author\nand committer, allow embedding this information in the .msg file, as\nsuggested by Sam Vilain <sam@vilain.net>.\n\n contrib/fast-import/import-tars.perl |   38 +++++++++++++++++++++++++++++++--\n 1 files changed, 35 insertions(+), 3 deletions(-)\n\ndiff --git a/contrib/fast-import/import-tars.perl b/contrib/fast-import/import-tars.perl\nindex 78e40d2..0d59434 100755\n--- a/contrib/fast-import/import-tars.perl\n+++ b/contrib/fast-import/import-tars.perl\n@@ -109,12 +109,44 @@ foreach my $tar_file (@ARGV)\n \t\t$have_top_dir = 0 if $top_dir ne $1;\n \t}\n \n+\t# Optionally read a commit message from <filename.tar>.msg\n+\t# Add a line on the form \"Committer: name <e-mail>\" to override\n+\t# the committer and \"Author: name <e-mail>\" to override the\n+\t# author for this tar ball.\n+\tmy $commit_msg = \"Imported from $tar_file.\";\n+\tmy $this_committer_name = $committer_name;\n+\tmy $this_committer_email = $committer_email;\n+\tmy $this_author_name = $author_name;\n+\tmy $this_author_email = $author_email;\n+\tif (open MSG, '<', \"${tar_file}.msg\")\n+\t{\n+\t\t$commit_msg = '';\n+\t\twhile (<MSG>)\n+\t\t{\n+\t\t\tif (/^Committer:\\s+([^<>]*)\\s+<(.*)>\\s*$/i)\n+\t\t\t{\n+\t\t\t\t$this_committer_name = $1;\n+\t\t\t\t$this_committer_email = $2;\n+\t\t\t}\n+\t\t\telsif (/^Author:\\s+([^<>]*)\\s+<(.*)>\\s*$/i)\n+\t\t\t{\n+\t\t\t\t$this_author_name = $1;\n+\t\t\t\t$this_author_email = $2;\n+\t\t\t}\n+\t\t\telse\n+\t\t\t{\n+\t\t\t\t$commit_msg .= $_;\n+\t\t\t}\n+\t\t}\n+\t\tclose MSG;\n+\t}\n+\n \tprint FI <<EOF;\n commit $branch_ref\n-author $author_name <$author_email> $author_time +0000\n-committer $committer_name <$committer_email> $commit_time +0000\n+author $this_author_name <$this_author_email> $author_time +0000\n+committer $this_committer_name <$this_committer_email> $commit_time +0000\n data <<END_OF_COMMIT_MESSAGE\n-Imported from $tar_file.\n+$commit_msg\n END_OF_COMMIT_MESSAGE\n \n deleteall\n-- \n1.6.3.3\n"}]}