forked from standardebooks/tools
-
Notifications
You must be signed in to change notification settings - Fork 0
/
view-modified
executable file
·54 lines (43 loc) · 1014 Bytes
/
view-modified
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
#!/bin/sh
usage(){
fmt <<EOF
DESCRIPTION
Check all author directories in the current or specified directory to see if there are changes that need to be committed.
USAGE
view-modified [DIRECTORY]
EOF
exit
}
if [ $# -eq 1 ]; then if [ "$1" = "--help" -o "$1" = "-h" ]; then usage; fi fi
#End boilerplate
rootDir="$(pwd)"
if [ $# -eq 1 ]; then
rootDir="$1"
fi
rootDir="$(cd -P "${rootDir}" && pwd)"
cd "${rootDir}"
for dir in "${rootDir}"/*; do
cd "${dir}"
clean="true"
upToDate="true"
git status | grep "nothing to commit, working directory clean" > /dev/null
if [ $? -ne 0 ]; then
clean="false"
fi
git branch -v | grep --extended-regexp "\[ahead [0-9]+\]" > /dev/null
if [ $? -eq 0 ]; then
upToDate="false"
fi
if [ "${clean}" = "false" -o "${upToDate}" = "false" ]; then
echo "${dir}"
fi
if [ "${clean}" = "false" ]; then
git status -s
fi
if [ "${upToDate}" = "false" ]; then
git branch -v
fi
if [ "${clean}" = "false" -o "${upToDate}" = "false" ]; then
echo ""
fi
done