> From: Matthieu Moy <Matthieu.Moy@xxxxxxxxxxxxxxx> > > const char *git_pager(int stdout_is_tty) > > { > > const char *pager; > > > > if (!stdout_is_tty) > > return NULL; > > > > pager = getenv("GIT_PAGER"); > > if (!pager) { > > if (!pager_program) > > git_config(git_default_config, NULL); > > pager = pager_program; > > } > > if (!pager) > > pager = getenv("PAGER"); > > if (!pager) > > pager = DEFAULT_PAGER; > > else if (!*pager || !strcmp(pager, "cat")) > > pager = NULL; > > I guess the "else" could and should be dropped. If you do so (and > possibly insert a blank line between the DEFAULT_PAGER case and the > "pager = NULL" case), you get a nice pattern > > if (!pager) > try_something(); > if (!pager) > try_next_option(); That's true, but it would change the effect of using "cat" as a value: "cat" as a value of DEFAULT_PAGER would cause git_pager() to return NULL, whereas now it causes git_pager() to return "cat". (All other places where "cat" can be a value are translated to NULL already.) This is why I want to know what the *intended* behavior is, because we might be changing Git's behavior, and I want to know that if we do that, we're changing it to what it should be. And I haven't seen anyone venture an opinion on what the intended behavior is. > I agree that a comment like this would help, though: > > --- a/cache.h > +++ b/cache.h > @@ -1266,7 +1266,7 @@ static inline ssize_t write_str_in_full(int fd, const char *str) > > /* pager.c */ > extern void setup_pager(void); > -extern const char *pager_program; > +extern const char *pager_program; /* value read from git_config() */ > extern int pager_in_use(void); > extern int pager_use_color; > extern int term_columns(void); First off, the wording is wrong, it should be "value set by git_config()". But that doesn't tell the reader what the significance of the value is. I suspect that a number of global variables need to be marked: > /* The pager program name, or "cat" if there is no pager. > * Can be overridden by the pager.<cmd> configuration value for a > * single command, or suppressed by the --no-pager option. > * Set by calling git_config(). > * NULL if hasn't been set yet by calling git_config(). */ > extern const char *pager_program; Dale -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html