summaryrefslogtreecommitdiff
path: root/reflog-walk.c
diff options
context:
space:
mode:
authorJeff King <peff@peff.net>2017-07-07 09:08:30 (GMT)
committerJunio C Hamano <gitster@pobox.com>2017-07-09 17:00:48 (GMT)
commit7f97de5ee1e1f9d28f45c8f7890e752f7b12bed1 (patch)
treeeaeecf98f49cf177a3df093f70ea287da6521b31 /reflog-walk.c
parent7c2f08aa7a26e68475abe5c9fd7250aacbb6b7b2 (diff)
downloadgit-7f97de5ee1e1f9d28f45c8f7890e752f7b12bed1.zip
git-7f97de5ee1e1f9d28f45c8f7890e752f7b12bed1.tar.gz
git-7f97de5ee1e1f9d28f45c8f7890e752f7b12bed1.tar.bz2
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 <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'reflog-walk.c')
-rw-r--r--reflog-walk.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/reflog-walk.c b/reflog-walk.c
index 081f89b..98c2f42 100644
--- a/reflog-walk.c
+++ b/reflog-walk.c
@@ -365,3 +365,8 @@ void show_reflog_message(struct reflog_walk_info *reflog_info, int oneline,
strbuf_release(&selector);
}
}
+
+int reflog_walk_empty(struct reflog_walk_info *info)
+{
+ return !info || !info->reflogs.nr;
+}