chiark
/
gitweb
/
~ianmdlvl
/
dgit.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
24f82ef
)
badcommit-fixup: more wip
author
Ian Jackson
<ijackson@chiark.greenend.org.uk>
Thu, 5 Jan 2017 00:13:37 +0000
(
00:13
+0000)
committer
Ian Jackson
<ijackson@chiark.greenend.org.uk>
Thu, 5 Jan 2017 00:13:37 +0000
(
00:13
+0000)
badcommit-fixup
patch
|
blob
|
history
diff --git
a/badcommit-fixup
b/badcommit-fixup
index 259775f510984c5c652b377905b3238e03f6ddd1..9cc61a9673fa9e52060a84bc774be0def321859e 100755
(executable)
--- a/
badcommit-fixup
+++ b/
badcommit-fixup
@@
-7,9
+7,12
@@
tmp=.git/dgit-badcommit-fixup-tmp
rm -rf $tmp
mkdir $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)
case `wc -l <$tmp/bad` in
0)
@@
-17,7
+20,7
@@
case `wc -l <$tmp/bad` in
exit 8 ;;
1)
read <$tmp/bad bads
exit 8 ;;
1)
read <$tmp/bad bads
- nots="^$
onlybad^0 ^$onlybad
^1"
+ nots="^$
bads^0 ^$bads
^1"
;;
*)
bads="cat $tmp/bad"
;;
*)
bads="cat $tmp/bad"
@@
-26,7
+29,7
@@
esac
args="$nots"
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
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
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