diff mbox series

[v4,06/10] git-contributors: make revspec required and shebang fix

Message ID 20250213-update-release-v4-6-c06883a8bbd6@kernel.org (mailing list archive)
State New
Headers show
Series Update release.sh | expand

Commit Message

Andrey Albershteyn Feb. 13, 2025, 8:14 p.m. UTC
Without default value script will show help instead of just hanging
waiting for input on stdin.

Shebang fix for system with different python location than the
/usr/bin one.

Cut leading delimiter from the final CC string.

Signed-off-by: Andrey Albershteyn <aalbersh@kernel.org>
---
 tools/git-contributors.py | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

Comments

Darrick J. Wong Feb. 13, 2025, 9:45 p.m. UTC | #1
On Thu, Feb 13, 2025 at 09:14:28PM +0100, Andrey Albershteyn wrote:
> Without default value script will show help instead of just hanging
> waiting for input on stdin.
> 
> Shebang fix for system with different python location than the
> /usr/bin one.
> 
> Cut leading delimiter from the final CC string.
> 
> Signed-off-by: Andrey Albershteyn <aalbersh@kernel.org>
> ---
>  tools/git-contributors.py | 8 ++------

Looks good,
Reviewed-by: "Darrick J. Wong" <djwong@kernel.org>

--D

>  1 file changed, 2 insertions(+), 6 deletions(-)
> 
> diff --git a/tools/git-contributors.py b/tools/git-contributors.py
> index 1a0f2b80e3dad9124b86b29f8507389ef91fe813..01177a9af749776ce4ac982f29f8f9302904d820 100755
> --- a/tools/git-contributors.py
> +++ b/tools/git-contributors.py
> @@ -1,4 +1,4 @@
> -#!/usr/bin/python3
> +#!/usr/bin/env python3
>  
>  # List all contributors to a series of git commits.
>  # Copyright(C) 2025 Oracle, All Rights Reserved.
> @@ -144,8 +144,7 @@ def main():
>      global DEBUG
>  
>      parser = argparse.ArgumentParser(description = "List email addresses of contributors to a series of git commits.")
> -    parser.add_argument("revspec", nargs = '?', default = None, \
> -            help = "git revisions to process.")
> +    parser.add_argument("revspec", help = "git revisions to process.")
>      parser.add_argument("--separator", type = str, default = '\n', \
>              help = "Separate each email address with this string.")
>      parser.add_argument('--debug', action = 'store_true', default = False, \
> @@ -160,9 +159,6 @@ def main():
>          # read git commits from repo
>          contributors = fd.run(backtick(['git', 'log', '--pretty=medium',
>                    args.revspec]))
> -    else:
> -        # read patch from stdin
> -        contributors = fd.run(sys.stdin.readlines())
>  
>      print(args.separator.join(sorted(contributors)))
>      return 0
> 
> -- 
> 2.47.2
> 
>
diff mbox series

Patch

diff --git a/tools/git-contributors.py b/tools/git-contributors.py
index 1a0f2b80e3dad9124b86b29f8507389ef91fe813..01177a9af749776ce4ac982f29f8f9302904d820 100755
--- a/tools/git-contributors.py
+++ b/tools/git-contributors.py
@@ -1,4 +1,4 @@ 
-#!/usr/bin/python3
+#!/usr/bin/env python3
 
 # List all contributors to a series of git commits.
 # Copyright(C) 2025 Oracle, All Rights Reserved.
@@ -144,8 +144,7 @@  def main():
     global DEBUG
 
     parser = argparse.ArgumentParser(description = "List email addresses of contributors to a series of git commits.")
-    parser.add_argument("revspec", nargs = '?', default = None, \
-            help = "git revisions to process.")
+    parser.add_argument("revspec", help = "git revisions to process.")
     parser.add_argument("--separator", type = str, default = '\n', \
             help = "Separate each email address with this string.")
     parser.add_argument('--debug', action = 'store_true', default = False, \
@@ -160,9 +159,6 @@  def main():
         # read git commits from repo
         contributors = fd.run(backtick(['git', 'log', '--pretty=medium',
                   args.revspec]))
-    else:
-        # read patch from stdin
-        contributors = fd.run(sys.stdin.readlines())
 
     print(args.separator.join(sorted(contributors)))
     return 0