commit:     e1350e68e944ea2b8972f1303635a29c7f77c05d
Author:     Kerin Millar <kfm <AT> plushkava <DOT> net>
AuthorDate: Sun Jun  8 16:51:27 2025 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Mon Jun  9 02:51:08 2025 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=e1350e68

ecompress: reduce the degree of indentation in do_queue()

Though some minor refactoring, reduce the maximal degree of indentation
reached by the do_queue() function. As much as I like structured code,
it was going a little overboard.

Signed-off-by: Kerin Millar <kfm <AT> plushkava.net>
Signed-off-by: Sam James <sam <AT> gentoo.org>

 bin/ecompress | 28 +++++++++++++---------------
 1 file changed, 13 insertions(+), 15 deletions(-)

diff --git a/bin/ecompress b/bin/ecompress
index 3266c1c735..20415bd872 100755
--- a/bin/ecompress
+++ b/bin/ecompress
@@ -83,21 +83,19 @@ do_queue() {
                        #
                        # note: to save time, we need to do this only if there's
                        # at least one compressed file
-                       case ${path} in
-                               *.Z|*.gz|*.bz2|*.lzma|.lz|.lzo|.lz4|*.xz|*.zst)
-                                       vpath=${path%.*}
-                                       for comp in '' .Z .gz .bz2 .lzma .lz 
.lzo .lz4 .xz .zst; do
-                                               if [[ ${vpath}${comp} != 
"${path}" && \
-                                                               -e 
${vpath}${comp} ]]; then
-                                                       collisions[${path}]=1
-                                                       collisions[${vpath}]=1
-                                                       # ignore compressed 
variants in that case
-                                                       continue 2
-                                               fi
-                                       done
-                                       printf '%s\n' "${path#"${D%/}"}" || ! 
break
-                                       ;;
-                       esac
+                       if [[ ${path} != *.@(Z|gz|bz2|lzma|lz|lzo|lz4|xz|zst) 
]]; then
+                               continue
+                       fi
+                       vpath=${path%.*}
+                       for comp in '' .{Z,gz,bz2,lzma,lz,lzo,lz4,xz,zst}; do
+                               if [[ ${vpath}${comp} != "${path}" && -e 
${vpath}${comp} ]]; then
+                                       collisions[$path]=1
+                                       collisions[$vpath]=1
+                                       # ignore compressed variants in that 
case
+                                       continue 2
+                               fi
+                       done
+                       printf '%s\n' "${path#"${D%/}"}" || ! break
 
                        : >> "${path}.ecompress" || die
                done \

Reply via email to