summaryrefslogtreecommitdiff
path: root/git-archimport.perl
diff options
context:
space:
mode:
authorPaolo Bonzini <paolo.bonzini@lu.unisi.ch>2007-02-28 21:02:02 +0100
committerJunio C Hamano <junkio@cox.net>2007-02-28 12:38:08 -0800
commita94f457e89f78a5a15e63417abdb281ce655f986 (patch)
tree61f3350dd43e18968db1060a697d95aee821ce36 /git-archimport.perl
parent2c46759db757eb742590e8547cb0c63e8bdb1da1 (diff)
downloadgit-a94f457e89f78a5a15e63417abdb281ce655f986.tar.gz
git-archimport: support empty summaries, put summary on a single line.
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 <junkio@cox.net>
Diffstat (limited to 'git-archimport.perl')
-rwxr-xr-xgit-archimport.perl19
1 files changed, 15 insertions, 4 deletions
diff --git a/git-archimport.perl b/git-archimport.perl
index 66aaeae102..0fcb156d14 100755
--- a/git-archimport.perl
+++ b/git-archimport.perl
@@ -553,7 +553,7 @@ foreach my $ps (@psets) {
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:
@@ -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*<([^\>]+)>/) {
@@ -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