From 7f97de5ee1e1f9d28f45c8f7890e752f7b12bed1 Mon Sep 17 00:00:00 2001 From: Jeff King Date: Fri, 7 Jul 2017 05:08:30 -0400 Subject: rev-list: check reflog_info before showing usage When git-rev-list sees no pending commits, it shows a usage message. This works even when reflog-walking is requested, because the reflog-walk code currently puts the reflog tips into the pending queue. In preparation for refactoring the reflog-walk code, let's explicitly check whether we have any reflogs to walk. For now this is a noop, but the existing reflog tests will make sure that it kicks in after the refactoring. Likewise, we'll add a test that "rev-list -g" without specifying any reflogs continues to fail (so that we know our check does not kick in too aggressively). Note that the implementation needs to go into its own sub-function, as the walk code does not expose its innards outside of reflog-walk.c. Signed-off-by: Jeff King Signed-off-by: Junio C Hamano --- reflog-walk.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'reflog-walk.h') diff --git a/reflog-walk.h b/reflog-walk.h index 27886f793e..af32361072 100644 --- a/reflog-walk.h +++ b/reflog-walk.h @@ -20,4 +20,6 @@ extern void get_reflog_selector(struct strbuf *sb, const struct date_mode *dmode, int force_date, int shorten); +extern int reflog_walk_empty(struct reflog_walk_info *walk); + #endif -- cgit v1.2.3