]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
contrib: add git gcc-style alias
authorJason Merrill <jason@redhat.com>
Tue, 12 Dec 2023 00:38:32 +0000 (19:38 -0500)
committerJason Merrill <jason@redhat.com>
Wed, 20 Dec 2023 23:08:16 +0000 (18:08 -0500)
I thought it could be easier to use check_GNU_style.py.  With this alias,
'git gcc-style' will take a git revision as argument instead of a file, or
check HEAD if no argument is given.

contrib/ChangeLog:

* gcc-git-customization.sh: Add git gcc-style alias.

contrib/gcc-git-customization.sh

index 2e173e859d7c2b5b6c0a4a187e41111a5bdd6340..54bd35ea1aab351f205baeafdc46c30dfd307a1d 100755 (executable)
@@ -30,6 +30,11 @@ git config alias.gcc-backport '!f() { "`git rev-parse --show-toplevel`/contrib/g
 git config alias.gcc-fix-changelog '!f() { "`git rev-parse --show-toplevel`/contrib/git-fix-changelog.py" $@; } ; f'
 git config alias.gcc-mklog '!f() { "`git rev-parse --show-toplevel`/contrib/mklog.py" $@; } ; f'
 git config alias.gcc-commit-mklog '!f() { "`git rev-parse --show-toplevel`/contrib/git-commit-mklog.py" "$@"; }; f'
+git config alias.gcc-style '!f() {
+    check=`git rev-parse --show-toplevel`/contrib/check_GNU_style.py;
+    arg=; if [ $# -ge 1 ] && [ "$1" != "-f" ]; then arg="$1"; shift;
+    elif [ $# -eq 3 ]; then arg="$3"; set -- "$1" "$2"; fi
+    git show $arg | $check "$@" -; }; f'
 
 # Make diff on MD files use "(define" as a function marker.
 # Use this in conjunction with a .gitattributes file containing