equal
deleted
inserted
replaced
39 |
39 |
40 # replace "/dev/null" by corresponded filename (as "-N" option) |
40 # replace "/dev/null" by corresponded filename (as "-N" option) |
41 diff -u "$file1" "$file2" | |
41 diff -u "$file1" "$file2" | |
42 sed "s@^--- /dev/null\(.*\)\$@--- $1\1@" | |
42 sed "s@^--- /dev/null\(.*\)\$@--- $1\1@" | |
43 sed "s@^\+\+\+ /dev/null\(.*\)\$@+++ $2\1@" |
43 sed "s@^\+\+\+ /dev/null\(.*\)\$@+++ $2\1@" |
|
44 |
|
45 # in this case, files differ from each other |
|
46 return 1 |
44 } |
47 } |
45 |
48 |
46 if test -d "$1" -o -d "$2"; then |
49 if test -d "$1" -o -d "$2"; then |
47 # ensure comparison in dictionary order |
50 # ensure comparison in dictionary order |
48 ( |
51 ( |
51 ) | |
54 ) | |
52 sed 's@^\./@@g' | sort | uniq | |
55 sed 's@^\./@@g' | sort | uniq | |
53 while read file; do |
56 while read file; do |
54 filediff "$1/$file" "$2/$file" "diff -Nru $1/$file $2/$file" |
57 filediff "$1/$file" "$2/$file" "diff -Nru $1/$file $2/$file" |
55 done |
58 done |
|
59 |
|
60 # TODO: there is no portable way for current while-read based |
|
61 # implementation to return 1 at detecting changes. |
|
62 # |
|
63 # On bash and dash, assignment to variable inside while-block |
|
64 # doesn't affect outside, because inside while-block is executed |
|
65 # in sub-shell. BTW, it affects outside while-block on ksh (as sh |
|
66 # on Solaris). |
56 else |
67 else |
57 filediff "$1" "$2" |
68 filediff "$1" "$2" |
58 fi |
69 fi |