{"thread":{"id":"17785","subject":"[PATCH] send-email: allow send-email to run outside a repo","startedAt":"2009-02-14T05:38:33Z","lastAt":"2009-02-14T06:42:53Z","messageCount":3,"participants":["Jay Soffian","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"104590","messageId":"1234589913-67684-1-git-send-email-jaysoffian@gmail.com","threadId":"17785","inReplyTo":null,"subject":"[PATCH] send-email: allow send-email to run outside a repo","fromName":"Jay Soffian","fromEmail":"jaysoffian@gmail.com","sentAt":"2009-02-14T05:38:33Z","receivedAt":"2009-02-14T05:38:33Z","isPatch":true,"sender":{"key":"jaysoffian@gmail.com","avatar":"https://avatars.githubusercontent.com/u/155970?v=4"},"body":"From: Jay Soffian <jaysoffian@gmail.com>\n\nsend-email is supposed to be able to run from outside a repo. This\nability was broken by commits caf0c3d6 (make the message file name more\nspecific) and 5df9fcf6 (interpret unknown files as revision lists).\n\nThis commit provides a fix for both.\n\nSigned-off-by: Jay Soffian <jaysoffian@gmail.com>\n---\nJunio,\n\nThis is on top of my previous send-email commits from tonight. I'm not\nsure whether it applies cleanly otherwise.\n\nj.\n\n git-send-email.perl |   13 +++++++++++--\n 1 files changed, 11 insertions(+), 2 deletions(-)\n\ndiff --git a/git-send-email.perl b/git-send-email.perl\nindex 23a55e2..49ed8c2 100755\n--- a/git-send-email.perl\n+++ b/git-send-email.perl\n@@ -23,7 +23,7 @@ use Getopt::Long;\n use Text::ParseWords;\n use Data::Dumper;\n use Term::ANSIColor;\n-use File::Temp qw/ tempdir /;\n+use File::Temp qw/ tempdir tempfile /;\n use Error qw(:try);\n use Git;\n \n@@ -157,7 +157,10 @@ if ($@) {\n # Behavior modification variables\n my ($quiet, $dry_run) = (0, 0);\n my $format_patch;\n-my $compose_filename = $repo->repo_path() . \"/.gitsendemail.msg.$$\";\n+my $compose_filename = ($repo ?\n+\ttempfile(\".gitsendemail.msg.XXXXXX\", DIR => $repo->repo_path()) :\n+\ttempfile(\".gitsendemail.msg.XXXXXX\", DIR => \".\"))[1];\n+\n \n # Handle interactive edition of files.\n my $multiedit;\n@@ -268,6 +271,9 @@ unless ($rc) {\n     usage();\n }\n \n+die \"Cannot run git format-patch from outside a repository\\n\"\n+\tif $format_patch and not $repo;\n+\n # Now, let's fill any that aren't set in with defaults:\n \n sub read_config {\n@@ -420,6 +426,7 @@ if (@alias_files and $aliasfiletype and defined $parse_alias{$aliasfiletype}) {\n \n # returns 1 if the conflict must be solved using it as a format-patch argument\n sub check_file_rev_conflict($) {\n+\treturn unless $repo;\n \tmy $f = shift;\n \ttry {\n \t\t$repo->command('rev-parse', '--verify', '--quiet', $f);\n@@ -461,6 +468,8 @@ while (defined(my $f = shift @ARGV)) {\n }\n \n if (@rev_list_opts) {\n+\tdie \"Cannot run git format-patch from outside a repository\\n\"\n+\t\tunless $repo;\n \tpush @files, $repo->command('format-patch', '-o', tempdir(CLEANUP => 1), @rev_list_opts);\n }\n \n-- \n1.6.2.rc0.238.g0c1fe\n"},{"id":"104599","messageId":"7vvdrdzfmm.fsf@gitster.siamese.dyndns.org","threadId":"17785","inReplyTo":"1234589913-67684-1-git-send-email-jaysoffian@gmail.com","subject":"Re: [PATCH] send-email: allow send-email to run outside a repo","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2009-02-14T06:39:29Z","receivedAt":"2009-02-14T06:39:29Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Jay Soffian <jaysoffian@gmail.com> writes:\n\n> This is on top of my previous send-email commits from tonight. I'm not\n> sure whether it applies cleanly otherwise.\n\nI think unlike the --suppress-cc ones that are about changing semantics\n(and it does not matter \"to a much saner one\"), this is a fix that is more\nimportant for the upcoming release.  Splitting Cc list and folding headers\nalso fall into the same category, I think.\n\nI'd prefer a rebased series to have fixes first and then enhancements.\n\nThanks.\n"},{"id":"104600","messageId":"7vocx5zfgy.fsf@gitster.siamese.dyndns.org","threadId":"17785","inReplyTo":"7vvdrdzfmm.fsf@gitster.siamese.dyndns.org","subject":"Re: [PATCH] send-email: allow send-email to run outside a repo","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2009-02-14T06:42:53Z","receivedAt":"2009-02-14T06:42:53Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Junio C Hamano <gitster@pobox.com> writes:\n\n> Jay Soffian <jaysoffian@gmail.com> writes:\n>\n>> This is on top of my previous send-email commits from tonight. I'm not\n>> sure whether it applies cleanly otherwise.\n>\n> I think unlike the --suppress-cc ones that are about changing semantics\n> (and it does not matter \"to a much saner one\"), this is a fix that is more\n> important for the upcoming release.  Splitting Cc list and folding headers\n> also fall into the same category, I think.\n>\n> I'd prefer a rebased series to have fixes first and then enhancements.\n>\n> Thanks.\n\nNah, please disregard.  This applies cleanly to the series before 3/3\nwhich I think should not be 1.6.2, so we are in good shape.\n\nThanks.\n"}]}