contrib: add git gcc-style alias

Message ID 20231212030031.1023808-1-jason@redhat.com
State Committed
Commit af3fc0306948f5b6abecad8453938c5bedb976fc
Headers
Series contrib: add git gcc-style alias |

Checks

Context Check Description
linaro-tcwg-bot/tcwg_gcc_build--master-aarch64 success Testing passed
linaro-tcwg-bot/tcwg_gcc_build--master-arm success Testing passed
linaro-tcwg-bot/tcwg_gcc_check--master-aarch64 success Testing passed

Commit Message

Jason Merrill Dec. 12, 2023, 3 a.m. UTC
  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(+)


base-commit: 074c6f15f7a28c620c756f18c2a310961de00539
  

Comments

Jason Merrill Dec. 19, 2023, 5:40 p.m. UTC | #1
On 12/11/23 22:00, Jason Merrill wrote:
> OK for trunk?

Ping.  CCing Alex because this could plausibly be considered build 
machinery, and he's had useful feedback on my sh code before.

> -- 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
  
Jeff Law Dec. 20, 2023, 5:10 a.m. UTC | #2
On 12/11/23 20:00, Jason Merrill wrote:
> 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.
Definitely OK.  Now we just need to make it part of everyone normal work 
flow.

jeff
  
Richard Biener Dec. 20, 2023, 7:39 a.m. UTC | #3
On Tue, Dec 19, 2023 at 6:41 PM Jason Merrill <jason@redhat.com> wrote:
>
> On 12/11/23 22:00, Jason Merrill wrote:
> > OK for trunk?
>
> Ping.  CCing Alex because this could plausibly be considered build
> machinery, and he's had useful feedback on my sh code before.

OK in case Alex doesn't have any comments.

Btw, is there a webpage where we document our git plumbing?  Would
be nice to update that with the new alias.

Richard.

> > -- 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
>
  
Alexandre Oliva Dec. 20, 2023, 11:04 p.m. UTC | #4
On Dec 19, 2023, Jason Merrill <jason@redhat.com> wrote:

> On 12/11/23 22:00, Jason Merrill wrote:
>> OK for trunk?

> Ping.  CCing Alex because this could plausibly be considered build
> machinery, and he's had useful feedback on my sh code before.

LGTM, thanks!
  
Jason Merrill Dec. 20, 2023, 11:10 p.m. UTC | #5
On 12/20/23 02:39, Richard Biener wrote:
> On Tue, Dec 19, 2023 at 6:41 PM Jason Merrill <jason@redhat.com> wrote:
>>
>> On 12/11/23 22:00, Jason Merrill wrote:
>>> OK for trunk?
>>
>> Ping.  CCing Alex because this could plausibly be considered build
>> machinery, and he's had useful feedback on my sh code before.
> 
> OK in case Alex doesn't have any comments.
> 
> Btw, is there a webpage where we document our git plumbing?  Would
> be nice to update that with the new alias.

Yep, updated it thus:
  

Patch

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