diff options
Diffstat (limited to 'v4l/scripts/prep_commit_msg.pl')
-rwxr-xr-x | v4l/scripts/prep_commit_msg.pl | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/v4l/scripts/prep_commit_msg.pl b/v4l/scripts/prep_commit_msg.pl new file mode 100755 index 000000000..239fb6092 --- /dev/null +++ b/v4l/scripts/prep_commit_msg.pl @@ -0,0 +1,41 @@ +#!/usr/bin/perl + +$f=shift; +open IN,"<$f"; +my $n=2; +my $from=""; +my $first=""; +my $changed=""; +$out=""; +while (<IN>) { + if (m/^[0-9]/) { + $n--; + next; + } + if ($n>0) { + s/[\t -]*//; + if (m/^\* (.*):/) { + $changed="#\t$1\n$changed"; + } else { + if ($first eq "") { + if ($_ eq "\n") { + next; + } + $first="$_"; + next; + } + if ($from eq "") { + if (m/Signed-off-by:/) { + $from = $_; + $from =~ s/Signed-off-by/From/; + $first="$first\n#\n# Then From line\n$from\n"; + } + } + $out="$out$_"; + } + } +} +printf "#Added/removed/changed files:\n%s" . + "# First line should be the subject, without Subject:\n%s" . + "# Then a detailed description followed by Signed-off-by: fields:\n%s", + $changed,$first,$out; |