Message ID | patch-v5-7.8-4795d4835b0-20211101T190630Z-avarab@gmail.com (mailing list archive) |
---|---|
State | Superseded |
Headers | show |
Series | progress: assert "global_progress" + test fixes / cleanup | expand |
On Mon, Nov 1, 2021 at 12:10 PM Ævar Arnfjörð Bjarmason <avarab@gmail.com> wrote: > > We have over 50 uses of "isatty(1)" and "isatty(2)" in the codebase, > only these two used the stdlib.h macros to refer to them. > > Let's change these for consistency, and because a subsequent commit's > commit message outlines a recipe to change all of these for ad-hoc > testing, not needing to match these with that ad-hoc regex will make > things easier to explain. > > Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> > --- > builtin/bisect--helper.c | 2 +- > builtin/bundle.c | 2 +- > compat/mingw.c | 2 +- > 3 files changed, 3 insertions(+), 3 deletions(-) > > diff --git a/builtin/bisect--helper.c b/builtin/bisect--helper.c > index 28a2e6a5750..1727cb051fb 100644 > --- a/builtin/bisect--helper.c > +++ b/builtin/bisect--helper.c > @@ -830,7 +830,7 @@ static int bisect_autostart(struct bisect_terms *terms) > fprintf_ln(stderr, _("You need to start by \"git bisect " > "start\"\n")); > > - if (!isatty(STDIN_FILENO)) > + if (!isatty(1)) STDIN_FILENO -> 0 Carlo
diff --git a/builtin/bisect--helper.c b/builtin/bisect--helper.c index 28a2e6a5750..1727cb051fb 100644 --- a/builtin/bisect--helper.c +++ b/builtin/bisect--helper.c @@ -830,7 +830,7 @@ static int bisect_autostart(struct bisect_terms *terms) fprintf_ln(stderr, _("You need to start by \"git bisect " "start\"\n")); - if (!isatty(STDIN_FILENO)) + if (!isatty(1)) return -1; /* diff --git a/builtin/bundle.c b/builtin/bundle.c index 5a85d7cd0fe..df69c651753 100644 --- a/builtin/bundle.c +++ b/builtin/bundle.c @@ -56,7 +56,7 @@ static int parse_options_cmd_bundle(int argc, static int cmd_bundle_create(int argc, const char **argv, const char *prefix) { int all_progress_implied = 0; - int progress = isatty(STDERR_FILENO); + int progress = isatty(2); struct strvec pack_opts; int version = -1; int ret; diff --git a/compat/mingw.c b/compat/mingw.c index 9e0cd1e097f..0f545c1a7d1 100644 --- a/compat/mingw.c +++ b/compat/mingw.c @@ -2374,7 +2374,7 @@ int mingw_raise(int sig) switch (sig) { case SIGALRM: if (timer_fn == SIG_DFL) { - if (isatty(STDERR_FILENO)) + if (isatty(2)) fputs("Alarm clock\n", stderr); exit(128 + SIGALRM); } else if (timer_fn != SIG_IGN)
We have over 50 uses of "isatty(1)" and "isatty(2)" in the codebase, only these two used the stdlib.h macros to refer to them. Let's change these for consistency, and because a subsequent commit's commit message outlines a recipe to change all of these for ad-hoc testing, not needing to match these with that ad-hoc regex will make things easier to explain. Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> --- builtin/bisect--helper.c | 2 +- builtin/bundle.c | 2 +- compat/mingw.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-)