Advertisement
Guest User

Untitled

a guest
Jul 24th, 2016
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.20 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. set -e
  4.  
  5. # actually parse the options and do stuff
  6. while [[ $1 = -?* ]]; do
  7. case $1 in
  8. --gc)
  9. echo "Repacking objects"
  10. git gc --aggressive --auto
  11. ;;
  12. *) ;;
  13. esac
  14.  
  15. shift
  16. done
  17.  
  18. # Summarize information about the current git repository
  19. NUMBER_OF_COMMITS=`git rev-list --all | wc -l`
  20. NUMBER_OF_OBJECTS=`git count-objects -v | grep in-pack | cut -f 2 -d ':'`
  21. NUMBER_OF_FILES=`git ls-files | wc -l | tr -d ' '`
  22. NUMBER_OF_CONTRIBUTORS=`git shortlog -s -n | wc -l | tr -d ' '`
  23. NUMBER_OF_REFS=`git show-ref --heads -s | wc -l | tr -d ' '`
  24. AGE=`git log --reverse --format='%cr' | head -n 1`
  25. REPO_SIZE=`du -hs $(git rev-parse --git-dir) | awk '{print $1}'` # count-objects has size-pack but that _requires_ the repository to be packed
  26.  
  27. # %'.3f\n
  28. printf "Repository size (approx): %12s\n" "${REPO_SIZE}"
  29. printf "Number of contributors : %'12.d\n" $NUMBER_OF_CONTRIBUTORS
  30. printf "Number of commits : %'12.d\n" $NUMBER_OF_COMMITS
  31. printf "Number of objects : %'12.d\n" $NUMBER_OF_OBJECTS
  32. printf "Number of files : %'12.d\n" $NUMBER_OF_FILES
  33. printf "Number of refs : %'12.d\n" $NUMBER_OF_REFS
  34. printf "First commit : %12s\n" "${AGE}"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement