chiark / gitweb /
cvs-adjustroot: silently succeed for */CVS/Root entries which already match the new...
[chiark-utils.git] / scripts / cvs-adjustroot
index 0e128cc4a98548ad2a145f16fd6066bbb2579076..0448d9a9f1ae72a03d2730e2a4558c4a050b18af 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 cvs-adjustroot --reinvoke "$old" "$new" '{}' ';'          \
+  -o   -exec false '{}' +                                              \
+  \)