On Thu, May 17, 2018 at 11:48:33AM +0200, Ævar Arnfjörð Bjarmason wrote: > > If there are ample branches, the warning message might be > > hidden out of screen but we shouldn't rely on that, I > > suppose. > > Also if we have lots of branches, depending on your pager settings you > won't see this at all, I have: We redirect stderr to the pager, as well, exactly to catch this sort of case. But because git-branch does not kick in the pager until later (because it only wants to do it for list-mode), that happens _after_ we've emitted the message. So one fix would be to teach deprecated_reflog_option_cb() to just set a flag rather than printing the warning, and then issue the warning. Something like this: diff --git a/builtin/branch.c b/builtin/branch.c index 452742fecf..f51b89e962 100644 --- a/builtin/branch.c +++ b/builtin/branch.c @@ -34,6 +34,7 @@ static const char * const builtin_branch_usage[] = { NULL }; +static int used_deprecated_reflog_option; static const char *head; static struct object_id head_oid; @@ -576,8 +577,7 @@ static int edit_branch_description(const char *branch_name) static int deprecated_reflog_option_cb(const struct option *opt, const char *arg, int unset) { - warning("the '-l' alias for '--create-reflog' is deprecated;"); - warning("it will be removed in a future version of Git"); + used_deprecated_reflog_option = 1; *(int *)opt->value = !unset; return 0; } @@ -703,6 +703,11 @@ int cmd_branch(int argc, const char **argv, const char *prefix) if (list) setup_auto_pager("branch", 1); + if (used_deprecated_reflog_option) { + warning("the '-l' alias for '--create-reflog' is deprecated;"); + warning("it will be removed in a future version of Git"); + } + if (delete) { if (!argc) die(_("branch name required")); On the other hand, I'm not sure this is that big a deal. The point of the deprecation warning is to catch people who are actually trying to use "-l" as "--create-reflog", and that case does not page. The people doing "git branch -l" are actually getting what they want eventually, which is to turn it into "--list". In the interim step where it becomes an unknown option, they'll get a hard error. -Peff