How to count the total LOC in Bitbucket's repo bare-repo?
#!/bin/bash
targetPath=/data/atlassian/bitbucket-data/shared/data/repositories/
temp=0
total=0
filename=branch_count.log
log=$targetPath/$filename
echo "Script Start -- $(date +%Y%m%d_%H%M)" >> $log
for f in `find $targetPath -maxdepth 1 -type d`;
do
cd $f
pwd | tee -a $log
for file in $(git ls-tree --name-only -r HEAD);
do
temp=`git show HEAD:"$file" | grep -v ^\# | wc -l`
total=$(($total + $temp))
echo $temp | tee -a $log
done
done
echo "Script End -- Total Branch in all Repo:$total" | tee -a $log
Sorry about the messy scripts. Rather amateur and in rush!
From setup to deployment—this learning path shows you how to build your first app using Forge. Learn the essentials, streamline workflows, and bring custom solutions to life across Jira, Confluence, and more.
Start Learning
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.