]> git.mjollnir.org Git - scripts.git/commitdiff
add formatpatches, small helper for turning git log output into patches
authorPenny Leach <penny@mjollnir.org>
Tue, 15 Sep 2009 10:57:20 +0000 (12:57 +0200)
committerPenny Leach <penny@mjollnir.org>
Tue, 15 Sep 2009 10:57:20 +0000 (12:57 +0200)
bin/formatpatches [new file with mode: 0755]

diff --git a/bin/formatpatches b/bin/formatpatches
new file mode 100755 (executable)
index 0000000..47ccbb4
--- /dev/null
@@ -0,0 +1,22 @@
+#!/usr/bin/perl -w
+
+# run this like:
+# git log --reverse <limiting parameters like --author or path/> | bin/formatpatches
+# inspect the output, then run again with | sh on the end
+
+use strict;
+use warnings;
+
+
+my $count = 0;
+
+while (<>) {
+    next unless /^commit ([a-z0-9]+)$/;
+    my $hash = $1;
+
+    print "git format-patch --start-number $count $hash^..$hash\n";
+    $count++;
+}
+
+
+1