-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgit-stat
More file actions
executable file
·51 lines (42 loc) · 828 Bytes
/
git-stat
File metadata and controls
executable file
·51 lines (42 loc) · 828 Bytes
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
#!/bin/bash
debug=false
function usage()
{
cat << _EOF_
usage:
$(basename $0) -a [AUTHOR] -d [DIRECTORY] [-h]
arguments:
-a Git commit author/email
-d Git directory
-h Print Help (this message) and exit
_EOF_
exit
}
function parsing_log()
{
cd $dir
git log --author=$author --pretty=tformat: --shortstat | \
awk '{ files += $1; add += $4; subs += $6 } END { printf "%s files changed, %s insertions(+), %s deletions(-)\n", files, add, subs }' -
}
while getopts ":a:d:h" opt;
do
case $opt in
a)
author=${OPTARG}
;;
d)
dir=${OPTARG}
;;
h)
usage
;;
*)
break
;;
esac
done
if [ $OPTIND -eq 1 ] || [ -z "$dir" ] || [ -z "$author" ]
then
usage
fi
parsing_log