-
Notifications
You must be signed in to change notification settings - Fork 1
/
gitfool
executable file
·47 lines (37 loc) · 852 Bytes
/
gitfool
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
#!/bin/bash
REPO_PATH=$1;
DAYS=$2;
PUSH=$3;
if [ ! -d ${REPO_PATH} ];then
echo ${REPO_PATH} 'is not a valid path'
exit
fi
if [ -n "`echo ${DAYS} | sed 's/[0-9]//g'`" ];then
echo ${DAYS} 'is not a valid number'
exit
fi
cd ${REPO_PATH}
git status > /dev/null 2>&1
if [ $? -ne 0 ];then
echo ${REPO_PATH} 'is not a valid repository'
exit
fi
echo -e "\nGitfool is generating your commits, please wait...\n"
for((i=0; i<=${DAYS}; i ++))
do
COUNT=$(($RANDOM%15))
date -v -1d > /dev/null 2>&1
if [ $? -ne 0 ];then
THIS_DATE=`date -d "${i} days ago"`
else
THIS_DATE=`date -v-${i}d -R`
fi
for((c=0; c<=${COUNT}; c ++))
do
git commit --allow-empty -m "update at ${THIS_DATE}" --date="${THIS_DATE}" > /dev/null 2>&1
done
done
if [ "${PUSH}" == "--push" ];then
git push
fi
echo -e "\n\n finished your Gitfull !!!"