-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdifffiles
More file actions
executable file
·35 lines (28 loc) · 883 Bytes
/
difffiles
File metadata and controls
executable file
·35 lines (28 loc) · 883 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
#! /bin/bash
if [ $# == 0 ]; then
wd=.files
mkdir -p "$wd"
else
wd="$1"
shift
fi
commit_line="$(head -n 1 "$wd/list")"
while read line ; do
if [ "$line" == "commit*" ] ; then
commit_line="$tmp_commit_line"
else
tmp_commit_line="$line";
fi
done < "$wd/list"
#echo commit_line = $commit_line
oldfiles="${commit_line% AND "$wd"/20*dirs}"
[ "$oldfiles" == "$commit_line" ] && oldfiles="${commit_line% AND "$wd"/21*dirs}"
[ "$oldfiles" == "$commit_line" ] && oldfiles="${commit_line% AND "$wd"/19*dirs}"
[ "$oldfiles" == "$commit_line" ] && { echo difffiles: can not separate files from dirs; exit 1; }
#echo oldfiles = "$oldfiles"
files="$(ls -1 "$wd"/20*-files "$wd"/19*-files "$wd"/21*-files 2>/dev/null | sort -r | head -n 1)"
if [ "$oldfiles" != "$files" ]; then
diff "$oldfiles" "$files" -u0 | runcpp diffiles-internal.cpp
else
echo изменений нет
fi