Adding Reviewed-by (and the like) tags

Soeren Sandmann sandmann at cs.au.dk
Fri May 6 04:45:30 PDT 2011


Cyril Brulebois <kibi at debian.org> writes:

> Hi,
>
> I guess it might be worth mentioning somewhere in the wiki how to
> easily (in an automated fashion) add r-b tags to a range of
> commits. Following Jon's suggestion on IRC, I've opted for:
>
> git filter-branch --msg-filter 'add-tag.sh "Reviewed-by: Peter Hutterer <peter.hutterer at who-t.net>" "Reviewed-by: Daniel Stone <daniel at fooishbar.org>"' origin/master..
>
> (You may want to pass -f if you play with it several times in a row.)

FWIW, I wrote a similar script (below). Among its features is that it
will not add the line if it already exists.

However, in my opinion, this feature really belongs in git itself, for
example as a "git rebase --reviewed-by='blah'".

Soren


[ssp at l3000 xserver]$ cat add-line.sh 
#!/bin/sh

usage() {
    cat <<EOF
Usage: add-line <line> [<filter-branch options>] <rev-list options>
EOF
}

line="$1"
[ -n "$line" ] || { usage >&2; exit 2; }
shift

script='
/'$line'/          { next; }
/^[a-zA-Z-]+: .*$/ { hyphenated_line = 1; print; next }
//                    { hyphenated_line = 0; print; next }
END { if (!hyphenated_line) { print "" } print "'$line'"; }'

#set -x
git filter-branch -f --msg-filter "awk '$script'" $@


More information about the xorg-devel mailing list