Skip to content

Commit

Permalink
Allow to run git-extras within git-bulk (#1008)
Browse files Browse the repository at this point in the history
Co-authored-by: guenthgr <[email protected]>
Fix #1007
  • Loading branch information
guenhter authored Dec 7, 2022
1 parent 960ec8d commit 7c4152c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
7 changes: 5 additions & 2 deletions bin/git-bulk
Original file line number Diff line number Diff line change
Expand Up @@ -133,12 +133,15 @@ function executBulkOp () {
eval cd "\"$rwsdir\""
local actual=$(pwd)
[ "${quiet?}" != "false" ] && echo 1>&2 "Executing bulk operation in workspace ${inverse}$actual${reset}"
eval find -L . -name ".git" | while read line; do

allGitFolders=( $(eval find -L . -name ".git") )

for line in ${allGitFolders[@]}; do
local gitrepodir=${line::${#line}-5} # cut the .git part of find results to have the root git directory of that repository
eval cd "\"$gitrepodir\"" # into git repo location
local curdir=$(pwd)
local leadingpath=${curdir#${actual}}
[ "${quiet?}" != "false" ] && echo 1>&2 "Current repository: ${leadingpath%/*}/${bldred}${curdir##*/}${reset}"
[ "${quiet?}" != "false" ] && echo 1>&2 "Current repository: ${leadingpath%/*}/${bldred}${curdir##*/}${reset}"
guardedExecution "$@"
eval cd "\"$rwsdir\"" # back to origin location of last find command
done
Expand Down
9 changes: 5 additions & 4 deletions bin/git-summary
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ fi
if [ -n "$SUMMARY_BY_LINE" ]; then
paths=( "$@" )
else
commit=""
test $# -ne 0 && commit=$*
commit="HEAD"
[ $# -ne 0 ] && commit=$*
fi
project=${PWD##*/}

Expand Down Expand Up @@ -191,13 +191,14 @@ if [ -n "$SUMMARY_BY_LINE" ]; then
echo " authors :"
lines "${paths[@]}" | sort | uniq -c | sort -rn | format_authors
else

echo " repo age : $(repository_age)"
# shellcheck disable=SC2086
echo " active : $(active_days $commit) days"
# shellcheck disable=SC2086
echo " commits : $(commit_count $commit)"
if test "$commit" = ""; then

# The file count doesn't support passing a git ref so ignore it if a ref is given
if [ "$commit" == "HEAD" ]; then
echo " files : $(file_count)"
fi
echo " authors : "
Expand Down

0 comments on commit 7c4152c

Please sign in to comment.