git: 6ba2f08cea8c - main - ls: --group-directories requires stat information

From: Piotr Pawel Stefaniak <pstef_at_FreeBSD.org>
Date: Wed, 22 Jan 2025 07:35:42 UTC
The branch main has been updated by pstef:

URL: https://cgit.FreeBSD.org/src/commit/?id=6ba2f08cea8cd5c801b78eb8842f7f96bf2d255c

commit 6ba2f08cea8cd5c801b78eb8842f7f96bf2d255c
Author:     Piotr Paweł Stefaniak <pstef@FreeBSD.org>
AuthorDate: 2025-01-21 22:47:30 +0000
Commit:     Piotr Paweł Stefaniak <pstef@FreeBSD.org>
CommitDate: 2025-01-22 07:29:29 +0000

    ls: --group-directories requires stat information
    
    Fixes:  8b92977857f8
---
 bin/ls/ls.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/bin/ls/ls.c b/bin/ls/ls.c
index ca0fb9877b7e..b3d0a508d714 100644
--- a/bin/ls/ls.c
+++ b/bin/ls/ls.c
@@ -547,12 +547,12 @@ main(int argc, char *argv[])
 #endif
 
 	/*
-	 * If not -F, -i, -l, -s, -S or -t options, don't require stat
-	 * information, unless in color mode in which case we do
-	 * need this to determine which colors to display.
+	 * If not -F, -i, -l, -s, -S, -t or --group-directories options,
+	 * don't require stat information, unless in color mode in which case
+	 * we do need this to determine which colors to display.
 	 */
 	if (!f_inode && !f_longform && !f_size && !f_timesort &&
-	    !f_sizesort && !f_type
+	    !f_sizesort && !f_type && f_groupdir == GRP_NONE
 #ifdef COLORLS
 	    && !f_color
 #endif