Skip to content

Commit

Permalink
git-archimport: support empty summaries, put summary on a single line.
Browse files Browse the repository at this point in the history
Don't fail if the summary line in an arch commit is empty.  In this case,
try to use the first line in the commit message followed by an ellipsis.
In addition, if the summary is multi-line, it is joined on a single line.

Signed-off-by: Junio C Hamano <[email protected]>
  • Loading branch information
Paolo Bonzini authored and Junio C Hamano committed Feb 28, 2007
1 parent 2c46759 commit a94f457
Showing 1 changed file with 15 additions and 4 deletions.
19 changes: 15 additions & 4 deletions git-archimport.perl
Original file line number Diff line number Diff line change
Expand Up @@ -553,7 +553,7 @@ sub process_patchset_fast {

my $pid = open2(*READER, *WRITER,'git-commit-tree',$tree,@par)
or die $!;
print WRITER $ps->{summary},"\n";
print WRITER $ps->{summary},"\n\n";
print WRITER $ps->{message},"\n";

# make it easy to backtrack and figure out which Arch revision this was:
Expand Down Expand Up @@ -755,7 +755,8 @@ sub parselog {
$ps->{tag} = $1;
$key = undef;
} elsif (/^Summary:\s*(.*)$/ ) {
# summary can be multiline as long as it has a leading space
# summary can be multiline as long as it has a leading space.
# we squeeze it onto a single line, though.
$ps->{summary} = [ $1 ];
$key = 'summary';
} elsif (/^Creator: (.*)\s*<([^\>]+)>/) {
Expand Down Expand Up @@ -787,8 +788,18 @@ sub parselog {
}
}

# post-processing:
$ps->{summary} = join("\n",@{$ps->{summary}})."\n";
# drop leading empty lines from the log message
while (@$log && $log->[0] eq '') {
shift @$log;
}
if (exists $ps->{summary} && @{$ps->{summary}}) {
$ps->{summary} = join(' ', @{$ps->{summary}});
}
elsif (@$log == 0) {
$ps->{summary} = 'empty commit message';
} else {
$ps->{summary} = $log->[0] . '...';
}
$ps->{message} = join("\n",@$log);

# skip Arch control files, unescape pika-escaped files
Expand Down

0 comments on commit a94f457

Please sign in to comment.