-
Notifications
You must be signed in to change notification settings - Fork 0
/
show-changed-files.sh
executable file
·55 lines (50 loc) · 1.33 KB
/
show-changed-files.sh
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
#!/bin/bash
for i in "$@"; do
case $i in
-p=*|--path=*)
projects_dir="${i#*=}"
eval projects_dir=$projects_dir
shift # past argument=value
;;
-b=*|--branch_name=*)
branch="${i#*=}"
shift # past argument=value
;;
-s=*|--start_commit=*)
start_commit="${i#*=}"
shift # past argument=value
;;
-e=*|--end_commit=*)
end_commit="${i#*=}"
shift # past argument=value
;;
--default)
projects_dir=.
shift # past argument with no value
;;
*)
# unknown option
;;
esac
done
cd "$projects_dir"
result_file_list=""
start=false
for commit in $(git rev-list $branch | tac); do
if [ "$commit" == "$start_commit" ]; then
start=true
fi
if [ "$start" = true ]; then
files=$(git diff-tree --no-commit-id --name-only -r "$commit")
#files=$(git diff-tree --no-commit-id --name-status -r "$commit")
if [ -z "$result_file_list" ]; then
result_file_list="$files"
else
result_file_list="$result_file_list\n$files"
fi
fi
if [ "$commit" == "$end_commit" ]; then
break
fi
done
echo -e "$result_file_list" | sort -u