Skip to content

Commit 7c4152c

Browse files
guenhterguenthgr
andauthored
Allow to run git-extras within git-bulk (#1008)
Co-authored-by: guenthgr <[email protected]> Fix #1007
1 parent 960ec8d commit 7c4152c

File tree

2 files changed

+10
-6
lines changed

2 files changed

+10
-6
lines changed

bin/git-bulk

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -133,12 +133,15 @@ function executBulkOp () {
133133
eval cd "\"$rwsdir\""
134134
local actual=$(pwd)
135135
[ "${quiet?}" != "false" ] && echo 1>&2 "Executing bulk operation in workspace ${inverse}$actual${reset}"
136-
eval find -L . -name ".git" | while read line; do
136+
137+
allGitFolders=( $(eval find -L . -name ".git") )
138+
139+
for line in ${allGitFolders[@]}; do
137140
local gitrepodir=${line::${#line}-5} # cut the .git part of find results to have the root git directory of that repository
138141
eval cd "\"$gitrepodir\"" # into git repo location
139142
local curdir=$(pwd)
140143
local leadingpath=${curdir#${actual}}
141-
[ "${quiet?}" != "false" ] && echo 1>&2 "Current repository: ${leadingpath%/*}/${bldred}${curdir##*/}${reset}"
144+
[ "${quiet?}" != "false" ] && echo 1>&2 "Current repository: ${leadingpath%/*}/${bldred}${curdir##*/}${reset}"
142145
guardedExecution "$@"
143146
eval cd "\"$rwsdir\"" # back to origin location of last find command
144147
done

bin/git-summary

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,8 @@ fi
4444
if [ -n "$SUMMARY_BY_LINE" ]; then
4545
paths=( "$@" )
4646
else
47-
commit=""
48-
test $# -ne 0 && commit=$*
47+
commit="HEAD"
48+
[ $# -ne 0 ] && commit=$*
4949
fi
5050
project=${PWD##*/}
5151

@@ -191,13 +191,14 @@ if [ -n "$SUMMARY_BY_LINE" ]; then
191191
echo " authors :"
192192
lines "${paths[@]}" | sort | uniq -c | sort -rn | format_authors
193193
else
194-
195194
echo " repo age : $(repository_age)"
196195
# shellcheck disable=SC2086
197196
echo " active : $(active_days $commit) days"
198197
# shellcheck disable=SC2086
199198
echo " commits : $(commit_count $commit)"
200-
if test "$commit" = ""; then
199+
200+
# The file count doesn't support passing a git ref so ignore it if a ref is given
201+
if [ "$commit" == "HEAD" ]; then
201202
echo " files : $(file_count)"
202203
fi
203204
echo " authors : "

0 commit comments

Comments
 (0)