forked from holatuwol/liferay-faster-deploy
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgitchanges
executable file
·56 lines (38 loc) · 1.4 KB
/
gitchanges
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
#!/bin/bash
gitchanges() {
# Generate the source trie
echo "Identifying module structure..."
$(dirname "${BASH_SOURCE[0]}")/sourcetrie
# Identify the changes
cat /dev/null > ${GIT_ROOT}/.redeploy/changes.txt
if [ "" != "$1" ] && [ "local" != "$1" ]; then
local COMPARE=
if [ "" == "$2" ]; then
COMPARE="$(git log -1 --pretty='%H' $1)..HEAD"
echo "Computing changes between HEAD and $1..."
else
COMPARE="$1..$2"
echo "Computing changes between $1 and $2..."
fi
git diff ${COMPARE} --name-only | grep -vF .iml | grep -vF rebel.xml | grep -vF yarn.lock >> ${GIT_ROOT}/.redeploy/changes.txt
fi
if [ "" == "$2" ]; then
echo "Computing local changes..."
git status -s | grep -vF '??' | grep -vF '.redeploy' | grep -vF .iml | grep -vF rebel.xml | grep -vF 'yarn.lock' | awk '{print $2}' >> ${GIT_ROOT}/.redeploy/changes.txt
fi
if [[ 0 -eq $(cat ${GIT_ROOT}/.redeploy/changes.txt | grep -c '^') ]]; then
echo 'No changes detected.'
cat /dev/null > ${GIT_ROOT}/.redeploy/changes_ant.txt
cat /dev/null > ${GIT_ROOT}/.redeploy/changes_gradle_1.txt
cat /dev/null > ${GIT_ROOT}/.redeploy/changes_gradle_2.txt
return 0
fi
# Identify the folders that changed
echo "Comparing changes to module structure..."
python $(dirname "${BASH_SOURCE[0]}")/gitchanges.py
echo "Change detection completed."
}
setopts() {
. $(dirname "${BASH_SOURCE[0]}")/setopts
}
setopts && gitchanges $@