All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] send-email: allow send-email to run outside a repo
@ 2009-02-14  5:38 Jay Soffian
  2009-02-14  6:39 ` Junio C Hamano
  0 siblings, 1 reply; 3+ messages in thread
From: Jay Soffian @ 2009-02-14  5:38 UTC (permalink / raw)
  To: git; +Cc: Jay Soffian, Pierre Habouzit, gitster

From: Jay Soffian <jaysoffian@gmail.com>

send-email is supposed to be able to run from outside a repo. This
ability was broken by commits caf0c3d6 (make the message file name more
specific) and 5df9fcf6 (interpret unknown files as revision lists).

This commit provides a fix for both.

Signed-off-by: Jay Soffian <jaysoffian@gmail.com>
---
Junio,

This is on top of my previous send-email commits from tonight. I'm not
sure whether it applies cleanly otherwise.

j.

 git-send-email.perl |   13 +++++++++++--
 1 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/git-send-email.perl b/git-send-email.perl
index 23a55e2..49ed8c2 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -23,7 +23,7 @@ use Getopt::Long;
 use Text::ParseWords;
 use Data::Dumper;
 use Term::ANSIColor;
-use File::Temp qw/ tempdir /;
+use File::Temp qw/ tempdir tempfile /;
 use Error qw(:try);
 use Git;
 
@@ -157,7 +157,10 @@ if ($@) {
 # Behavior modification variables
 my ($quiet, $dry_run) = (0, 0);
 my $format_patch;
-my $compose_filename = $repo->repo_path() . "/.gitsendemail.msg.$$";
+my $compose_filename = ($repo ?
+	tempfile(".gitsendemail.msg.XXXXXX", DIR => $repo->repo_path()) :
+	tempfile(".gitsendemail.msg.XXXXXX", DIR => "."))[1];
+
 
 # Handle interactive edition of files.
 my $multiedit;
@@ -268,6 +271,9 @@ unless ($rc) {
     usage();
 }
 
+die "Cannot run git format-patch from outside a repository\n"
+	if $format_patch and not $repo;
+
 # Now, let's fill any that aren't set in with defaults:
 
 sub read_config {
@@ -420,6 +426,7 @@ if (@alias_files and $aliasfiletype and defined $parse_alias{$aliasfiletype}) {
 
 # returns 1 if the conflict must be solved using it as a format-patch argument
 sub check_file_rev_conflict($) {
+	return unless $repo;
 	my $f = shift;
 	try {
 		$repo->command('rev-parse', '--verify', '--quiet', $f);
@@ -461,6 +468,8 @@ while (defined(my $f = shift @ARGV)) {
 }
 
 if (@rev_list_opts) {
+	die "Cannot run git format-patch from outside a repository\n"
+		unless $repo;
 	push @files, $repo->command('format-patch', '-o', tempdir(CLEANUP => 1), @rev_list_opts);
 }
 
-- 
1.6.2.rc0.238.g0c1fe

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] send-email: allow send-email to run outside a repo
  2009-02-14  5:38 [PATCH] send-email: allow send-email to run outside a repo Jay Soffian
@ 2009-02-14  6:39 ` Junio C Hamano
  2009-02-14  6:42   ` Junio C Hamano
  0 siblings, 1 reply; 3+ messages in thread
From: Junio C Hamano @ 2009-02-14  6:39 UTC (permalink / raw)
  To: Jay Soffian; +Cc: git, Pierre Habouzit

Jay Soffian <jaysoffian@gmail.com> writes:

> This is on top of my previous send-email commits from tonight. I'm not
> sure whether it applies cleanly otherwise.

I think unlike the --suppress-cc ones that are about changing semantics
(and it does not matter "to a much saner one"), this is a fix that is more
important for the upcoming release.  Splitting Cc list and folding headers
also fall into the same category, I think.

I'd prefer a rebased series to have fixes first and then enhancements.

Thanks.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] send-email: allow send-email to run outside a repo
  2009-02-14  6:39 ` Junio C Hamano
@ 2009-02-14  6:42   ` Junio C Hamano
  0 siblings, 0 replies; 3+ messages in thread
From: Junio C Hamano @ 2009-02-14  6:42 UTC (permalink / raw)
  To: Jay Soffian; +Cc: git, Pierre Habouzit

Junio C Hamano <gitster@pobox.com> writes:

> Jay Soffian <jaysoffian@gmail.com> writes:
>
>> This is on top of my previous send-email commits from tonight. I'm not
>> sure whether it applies cleanly otherwise.
>
> I think unlike the --suppress-cc ones that are about changing semantics
> (and it does not matter "to a much saner one"), this is a fix that is more
> important for the upcoming release.  Splitting Cc list and folding headers
> also fall into the same category, I think.
>
> I'd prefer a rebased series to have fixes first and then enhancements.
>
> Thanks.

Nah, please disregard.  This applies cleanly to the series before 3/3
which I think should not be 1.6.2, so we are in good shape.

Thanks.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2009-02-14  6:45 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-02-14  5:38 [PATCH] send-email: allow send-email to run outside a repo Jay Soffian
2009-02-14  6:39 ` Junio C Hamano
2009-02-14  6:42   ` Junio C Hamano

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.