From 1d6ea68133289ceab2637ce7095772678af792c6 Mon Sep 17 00:00:00 2001 From: skshetry <18718008+skshetry@users.noreply.github.com> Date: Sun, 9 Feb 2025 12:16:53 +0545 Subject: [PATCH] ls/ls-url: do not show entry with size<=0 for a directory (#10687) ls/ls-url: do not show size=0 when the entry is a directory --- dvc/commands/ls/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dvc/commands/ls/__init__.py b/dvc/commands/ls/__init__.py index 550b5820b..bfc1bd675 100644 --- a/dvc/commands/ls/__init__.py +++ b/dvc/commands/ls/__init__.py @@ -28,7 +28,7 @@ def _format_entry(entry, name, with_size=True, with_hash=False): ret = [] if with_size: size = entry.get("size") - if size is None: + if size is None or (size <= 0 and entry.get("isdir")): size = "" else: size = naturalsize(size)