git-svn: fix --file/-F option in commit-diff

Also, allow messages from tags to be used as
commit messages.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
This commit is contained in:
Eric Wong
2006-07-09 20:20:48 -07:00
committed by Junio C Hamano
parent 344c52aee5
commit 4ad4515dfe

View File

@ -760,7 +760,7 @@ sub commit_diff {
exit 1; exit 1;
} }
if (defined $_file) { if (defined $_file) {
$_message = file_to_s($_message); $_message = file_to_s($_file);
} else { } else {
$_message ||= get_commit_message($tb, $_message ||= get_commit_message($tb,
"$GIT_DIR/.svn-commit.tmp.$$")->{msg}; "$GIT_DIR/.svn-commit.tmp.$$")->{msg};
@ -1518,12 +1518,12 @@ sub get_commit_message {
open my $msg, '>', $commit_msg or croak $!; open my $msg, '>', $commit_msg or croak $!;
chomp(my $type = `git-cat-file -t $commit`); chomp(my $type = `git-cat-file -t $commit`);
if ($type eq 'commit') { if ($type eq 'commit' || $type eq 'tag') {
my $pid = open my $msg_fh, '-|'; my $pid = open my $msg_fh, '-|';
defined $pid or croak $!; defined $pid or croak $!;
if ($pid == 0) { if ($pid == 0) {
exec(qw(git-cat-file commit), $commit) or croak $!; exec('git-cat-file', $type, $commit) or croak $!;
} }
my $in_msg = 0; my $in_msg = 0;
while (<$msg_fh>) { while (<$msg_fh>) {