-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlog.sh
More file actions
executable file
·49 lines (49 loc) · 968 Bytes
/
log.sh
File metadata and controls
executable file
·49 lines (49 loc) · 968 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
# Generates git changelog grouped by day and output it to file
#
# optional parameters
# -a to filter by author
# -s to select start date
# -e to select end date
# -o to save it to file
# -r to specify the repository path
NEXT=$(date +%F)
SINCE="January"
UNTIL=$NEXT
AUTHOR=$(git config iforvert.iforvert@gmail.com)
OUTPUT="$(date +%F).log"
while getopts "a:s:e:o:r:" arg
do
case $arg in
a)
AUTHOR=$OPTARG
;;
s)
SINCE=$OPTARG
;;
e)
UNTIL=$OPTARG
;;
o)
OUTPUT=$OPTARG
;;
r)
REPO=$OPTARG
;;
?)
echo "unknown argument"
exit 1
;;
esac
done
(
git -C "${REPO}" log --author="${AUTHOR}" --since="${SINCE}" --until="${UNTIL}" --format="%cd" --date=short | sort -u | while read DATE ; do
GIT_PAGER=$(git -C "${REPO}" log --no-merges --reverse --format="* %s" --since="${DATE} 00:00:00" --until="${DATE} 23:59:59" --author="${AUTHOR}")
if [ ! -z "$GIT_PAGER" ]
then
echo "[${DATE}]"
echo "${GIT_PAGER}"
echo
fi
done
) > $OUTPUT
echo "log is written to ${OUTPUT}"