Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
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...
commit 27cb5f2b26f105e9381cfbd26cef67b2aff14140 1 parent e453c04
@afresh1 authored
Showing with 15 additions and 20 deletions.
  1. +15 −20 commits-to-twitter.pl
View
35 commits-to-twitter.pl
@@ -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;
Please sign in to comment.
Something went wrong with that request. Please try again.