Re: [PATCH 2/5] git send-email: interpret unknown files as revision lists
From: Junio C Hamano <hidden>
Date: 2016-06-15 22:45:36
Pierre Habouzit [off-list ref] writes:
quoted hunk ↗ jump to hunk
diff --git a/git-send-email.perl b/git-send-email.perl index aaace02..c29868a 100755 --- a/git-send-email.perl +++ b/git-send-email.perl@@ -22,8 +22,11 @@ use Term::ReadLine; use Getopt::Long; use Data::Dumper; use Term::ANSIColor; +use File::Temp qw/ tempdir /;
We seem to use File::Temp::tempdir already elsewhere, but they are in archimport, cvsexportcommit and cvsserver, all of which are rather rarely used ones. I think this is Perl 5.6.1 addition. Is everybody Ok with this dependency? Just double checking.
quoted hunk ↗ jump to hunk
@@ -363,10 +366,22 @@ if (@alias_files and $aliasfiletype and defined $parse_alias{$aliasfiletype}) { ($sender) = expand_aliases($sender) if defined $sender; +sub check_file_rev_conflict($) { + my $f = shift; + if ($repo->command('rev-parse', '--verify', '--quiet', $f)) { + die("revision/filename conflict on `$f'");
Perhaps wording this a bit more to the point? This is triggered when
'$f' can be both a filename or a revision, so...
File '$f' exists but it could also be the range of commits
to produce patches for. Please disambiguate by...
* Saying "./$f" if you mean a file; or
* Giving -F option if you mean a range.
Earlier I suggested that "origin^0" is a way for the user to disambiguate
favouring a rev, but such a filename can exist, so we cannot blindly
suggest to say "$f^0" here. I think adding -F (or --format-patch) option
to send-email to explicitly disable file/directory interpretation would be
a cleaner solution for this (and it would allow you to drive this from a
script without worrying about what garbage files you happen to have in the
working tree).