chiark / gitweb /
fishdescriptor: wip reconsider approach
[chiark-utils.git] / scripts / cvs-adjustroot
index 0e128cc4a98548ad2a145f16fd6066bbb2579076..080029c7320a7b549b137e1a4eab1aec682a828a 100755 (executable)
@@ -35,10 +35,19 @@ new="$1"; shift
 
 if $reinvoke; then
        filename="$1";
+       if cmp -- "$filename" <(printf "%s\n" "$new"); then exit 0; fi
        cmp -- "$filename" <(printf "%s\n" "$old")
        printf "%s\n" "$new" >"$filename".new
        mv -f -- "$filename".new "$filename"
        exit 0
 fi
 
-find -path '*/CVS/Root' -exec cvs-adjustroot --reinvoke "$old" "$new" '{}' ';'
+# GNU find provides + exec variants which set exit status and pass
+# multiple arguments, or \; variants which pass one argument but do
+# not set exit status.  So use a separate -exec false + to arrange for
+# nonzero exit status when appropriate.
+
+find   -path '*/CVS/Root'                                              \
+  \(   -exec "$0" --reinvoke "$old" "$new" '{}' ';'                    \
+  -o   -exec false '{}' +                                              \
+  \)