Permalink
Browse files

Split handling of Log Message out

Makes the code simpler and now I can tell the sometimes the M is upper and
sometimes lower case.
  • Loading branch information...
afresh1 committed Jul 8, 2012
1 parent e453c04 commit 27cb5f2b26f105e9381cfbd26cef67b2aff14140
Showing with 15 additions and 20 deletions.
  1. +15 −20 commits-to-twitter.pl
View
@@ -182,31 +182,26 @@ sub parse_commit {
next;
}
- if (/^(\w+ files|Log message):/) {
+ if (/^(\w+ files):/) {
$key = $1;
next;
}
if ($key) {
- if ( $key eq 'Log message' ) {
- $commit{$key} = $_;
- $commit{$key} .= $_ while <$fh>;
- }
- else {
- chomp;
- s/^\s+//;
- unless ($_) {
- $key = '';
- next;
- }
-
- my (@files) = split /\s*:\s+/;
- $dir = shift @files if @files > 1;
- @files = map {split} @files;
- next unless $dir;
-
- push @{ $commit{$key}{$dir} }, @files;
- }
+ chomp;
+ s/^\s+//;
+ unless ($_) { $key = ''; next; }
+
+ my (@files) = split /\s*:\s+/;
+ $dir = shift @files if @files > 1;
+ @files = map {split} @files;
+ next unless $dir;
+
+ push @{ $commit{$key}{$dir} }, @files;
+ }
+
+ if (/^Log [Mm]essage:/) {
+ $commit{'Log message'} .= $_ while <$fh>;
}
}
close $fh;

0 comments on commit 27cb5f2

Please sign in to comment.