-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgit-winner
executable file
·80 lines (62 loc) · 2.1 KB
/
git-winner
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
# #!/usr/bin/env bash
# # Copyright © 2008 Garry C. Dolley
# # https://github.com/up_the_irons/git-winner
# function usage() {
# echo "git-winner by Garry Dolley (http://scie.nti.st)"
# echo ""
# echo "Usage: $0 [date]"
# exit
# }
# case $1 in
# -h) usage;;
# --help) usage;;
# esac
# if [ -n "$1" ]; then
# DATE=$1
# else
# DATE=01-01-1970
# fi
# PLAYERS=$(git shortlog --all --after=$DATE | grep '^\w' | sed 's/\(.*\) ([0-9]*):/\1/')
# HIGHEST_COMMIT_COUNT=0
# HIGHEST_COMMIT_LINES=0
# echo "Activity after $DATE"
# echo ""
# if [ -z "$PLAYERS" ]; then
# echo "No players!"
# echo ""
# echo "Appears there have been no commits after $DATE. Try an earlier date."
# exit
# fi
# IFS='
# '
# for player in $PLAYERS; do
# COMMIT_COUNT=$(git shortlog --all --after=$DATE --author="$player" | grep ^"$player (" | sed "s/$player (\(.*\)):/\1/")
# COMMIT_LINES=$(git log --all --after=$DATE --author="$player" --pretty=format: --stat | grep '[0-9]* files changed, [0-9]* insertions.*, [0-9]* deletions' | awk '{ sum += $4 + $6} END { print sum }')
# if [ -z "$COMMIT_COUNT" ]; then
# COMMIT_COUNT=0
# fi
# if [ -z "$COMMIT_LINES" ]; then
# COMMIT_LINES=0
# fi
# if [ "$COMMIT_COUNT" -gt "$HIGHEST_COMMIT_COUNT" ]; then
# HIGHEST_COMMIT_COUNT=$COMMIT_COUNT
# HIGHEST_COMMIT_COUNT_PLAYER=$player
# fi
# if [ "$COMMIT_LINES" -gt "$HIGHEST_COMMIT_LINES" ]; then
# HIGHEST_COMMIT_LINES=$COMMIT_LINES
# HIGHEST_COMMIT_LINES_PLAYER=$player
# fi
# echo "Results for $player:"
# echo " # of commits : $COMMIT_COUNT"
# echo " # of lines committed: $COMMIT_LINES"
# done
# if [ "$HIGHEST_COMMIT_COUNT" -gt 0 ]; then
# echo ""
# echo "$HIGHEST_COMMIT_COUNT_PLAYER wins in commit count with $HIGHEST_COMMIT_COUNT commits!"
# echo "$HIGHEST_COMMIT_LINES_PLAYER wins in number of lines commited with $HIGHEST_COMMIT_LINES lines!"
# if [ "$HIGHEST_COMMIT_COUNT_PLAYER" = "$HIGHEST_COMMIT_LINES_PLAYER" ]; then
# FIRST_NAME=$(echo "$HIGHEST_COMMIT_COUNT_PLAYER" | awk '{ print $1 }')
# echo ""
# echo "$FIRST_NAME is the overall winner!!"
# fi
# fi