utils/get-developers: read patch from stdin when it's not a tty

It is very common that get-developers be used with its stdin a pipe from
git-show:
    git show |./utils-get-developers -

In this case, the '-' is superfluous: we can very easily deduce that the
user wants to read stdin as the patch.

So, if no other action was requested, and stdin is not a tty, use it as
the source of the patch, and thus '-' is then no longer required.

Signed-off-by: Yann E. MORIN <yann.morin@orange.com>
Signed-off-by: Julien Olivain <ju.o@free.fr>
This commit is contained in:
Yann E. MORIN
2024-12-23 08:27:18 +01:00
committed by Julien Olivain
parent 35f381b93e
commit d10d22221f

View File

@@ -42,7 +42,9 @@ def __main__():
if action > 1:
parser.error("Cannot do more than one action")
if action == 0:
parser.error("No action specified")
if sys.stdin.isatty():
parser.error("No action specified")
args.patches.append(sys.stdin)
devs = getdeveloperlib.parse_developers(args.filename)
if devs is None: