Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow to run git-extras within git-bulk #1008

Merged
merged 1 commit into from
Dec 7, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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