public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] contrib: add git gcc-style alias
@ 2023-12-12  3:00 Jason Merrill
  2023-12-19 17:40 ` Ping " Jason Merrill
  2023-12-20  5:10 ` Jeff Law
  0 siblings, 2 replies; 6+ messages in thread
From: Jason Merrill @ 2023-12-12  3:00 UTC (permalink / raw)
  To: gcc-patches

OK for trunk?

-- 8< --

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 | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/contrib/gcc-git-customization.sh b/contrib/gcc-git-customization.sh
index 2e173e859d7..54bd35ea1aa 100755
--- a/contrib/gcc-git-customization.sh
+++ b/contrib/gcc-git-customization.sh
@@ -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

base-commit: 074c6f15f7a28c620c756f18c2a310961de00539
-- 
2.39.3


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2023-12-20 23:10 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-12-12  3:00 [PATCH] contrib: add git gcc-style alias Jason Merrill
2023-12-19 17:40 ` Ping " Jason Merrill
2023-12-20  7:39   ` Richard Biener
2023-12-20 23:10     ` Jason Merrill
2023-12-20 23:04   ` Alexandre Oliva
2023-12-20  5:10 ` Jeff Law

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).