summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIan Jackson <ijackson@chiark.greenend.org.uk>2017-01-05 00:13:37 +0000
committerIan Jackson <ijackson@chiark.greenend.org.uk>2017-01-05 00:13:37 +0000
commit4f599d564126aca140c99c32c305dcb58950a185 (patch)
tree4e1760f54e7673101571ed93056b362f0c83254a
parent24f82efdfcec70f49f76624f25251fba47f1dc88 (diff)
badcommit-fixup: more wip
-rwxr-xr-xbadcommit-fixup25
1 files changed, 19 insertions, 6 deletions
diff --git a/badcommit-fixup b/badcommit-fixup
index 259775f..9cc61a9 100755
--- a/badcommit-fixup
+++ b/badcommit-fixup
@@ -7,9 +7,12 @@ tmp=.git/dgit-badcommit-fixup-tmp
rm -rf $tmp
mkdir $tmp
-LC_MESSAGES=C git fsck --no-dangling 2>&1 | \
- perl -ne 'print $1 if m/^error in commit d1a977e7f9637372750ac02a58e85c35ddd4ca54:.*invalid format - expected '\''committer' | \
- >$tmp/bad
+LC_MESSAGES=C git fsck --no-dangling >$tmp/gfo 2>&1 || test $? = 1
+
+perl -ne '
+ print $1, "\n" or die $! if
+ m/^error in commit (\w+):.*invalid format - expected '\''committer/;
+' <$tmp/gfo >$tmp/bad
case `wc -l <$tmp/bad` in
0)
@@ -17,7 +20,7 @@ case `wc -l <$tmp/bad` in
exit 8 ;;
1)
read <$tmp/bad bads
- nots="^$onlybad^0 ^$onlybad^1"
+ nots="^$bads^0 ^$bads^1"
;;
*)
bads="cat $tmp/bad"
@@ -26,7 +29,7 @@ esac
args="$nots"
-for head in `git-show-ref --heads`; do
+for head in HEAD `git-for-each-ref --format='%(refname)'`; do
exec <$tmp/bad
needed=false
for bad in $bads; do
@@ -39,4 +42,14 @@ for head in `git-show-ref --heads`; do
args+=" $head"
done
-echo $args
+cat >$tmp/flt <<'END'
+#!/usr/bin/perl -w
+use strict;
+undef $/;
+$_ = <STDIN>;
+s/^(\w+.*\n)*commiter /$1committer /;
+END
+
+git filter-branch --original dgit-badcommit --commit-filter '
+ sed -e '\''1,/^$/ s/^commiter /committer /'\''
+' $args