From e4e7310c498f568f92a76921a115b2f892553f2e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?G=C3=BCnther=20Grill?= Date: Fri, 20 Jan 2023 11:18:10 +0100 Subject: [PATCH] Make the bulk output slimmer (#1020) Co-authored-by: guenthgr --- bin/git-bulk | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/bin/git-bulk b/bin/git-bulk index 69adf2e..f6899fc 100755 --- a/bin/git-bulk +++ b/bin/git-bulk @@ -59,19 +59,19 @@ function listall { git config --global --get-regexp bulkworkspaces; } # guarded execution of a git command in one specific repository function guardedExecution () { - if $guardedmode; then - echo 1>&2 -n "${inverse}git $gitcommand${reset} -> execute here (y/n)? " - read -n 1 -r &2 - if [[ $REPLY =~ ^[Yy]$ ]]; then atomicExecution "$@"; fi - else - atomicExecution "$@" + if [ "${quiet?}" != "true" ] || $guardedmode; then + echo 1>&2 "${bldred}->${reset} executing ${inverse}git $gitcommand${reset} in repository ${leadingpath%/*}/${bldred}${curdir##*/}${reset}" fi -} -# atomic git command execution with log -function atomicExecution () { - [ "${quiet?}" != "true" ] && echo 1>&2 "${bldred}->${reset} executing ${inverse}git $gitcommand${reset}" - git "$@" + if $guardedmode; then + echo 1>&2 -n " Execute command here (y/n)? " + read -n 1 -r &2 + if [[ $REPLY =~ ^[Yy]$ ]]; then + git "$@" + fi + else + git "$@" + fi } # check if the passed command is known as a core git command @@ -142,7 +142,6 @@ function executBulkOp () { eval cd "\"$gitrepodir\"" # into git repo location local curdir=$(pwd) local leadingpath=${curdir#${actual}} - [ "${quiet?}" != "true" ] && echo 1>&2 "Current repository: ${leadingpath%/*}/${bldred}${curdir##*/}${reset}" guardedExecution "$@" eval cd "\"$rwsdir\"" # back to origin location of last find command done