etc-update: ignore changes in whitespace (-b) for automerge
authorMike Frysinger <vapier@gentoo.org>
Mon, 12 Mar 2012 04:40:12 +0000 (00:40 -0400)
committerMike Frysinger <vapier@gentoo.org>
Mon, 12 Mar 2012 04:40:25 +0000 (00:40 -0400)
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
bin/etc-update

index 75c6ba1b5e9e29ccf8d2afbed6cde954db4ebde8..135de4557f9f9564f3026f138a482f4ae6124d18 100755 (executable)
@@ -124,18 +124,16 @@ scan() {
                                        else
                                                diff -Bbua "${cfg_file}" "${live_file}" | \
                                                        sed -n -r \
-                                                               -e '/^[+-]/{/^([+-][\t ]*(#|$)|-{3} |\+{3} )/d;q0}' \
-                                                               -e '$q1'
-                                               MATCHES=$?
+                                                               -e '/^[+-]/{/^([+-][\t ]*(#|$)|-{3} |\+{3} )/d;q1}'
+                                               : $(( MATCHES = ($? == 0) ))
                                        fi
 
-                               elif diff -Nua "${cfg_file}" "${live_file}" |
-                                       sed -n \
-                                               -e '/# .Header:/d' \
-                                               -e '/^[+-][^+-]/q1' \
-                                               -e '$q0'
-                               then
-                                       MATCHES=1
+                               else
+                                       diff -Nbua "${cfg_file}" "${live_file}" |
+                                               sed -n \
+                                                       -e '/# .Header:/d' \
+                                                       -e '/^[+-][^+-]/q1'
+                                       : $(( MATCHES = ($? == 0) ))
                                fi
 
                                if [[ ${MATCHES} == 1 ]] ; then
@@ -152,18 +150,17 @@ scan() {
                                fi
                        fi
 
-                       if diff -Nua "${cfg_file}" "${rpath}/${ofile}" |
+                       if ! diff -Nbua "${cfg_file}" "${rpath}/${ofile}" |
                                sed -n \
                                        -e '/# .Header:/d' \
-                                       -e '/^[+-][^+-]/q1' \
-                                       -e '$q0'
+                                       -e '/^[+-][^+-]/q1'
                        then
-                               mv "${cfg_file}" "${rpath}/${ofile}"
-                               continue
-                       else
                                echo "${cfg_file}" >> "${TMP}"/files/${count}
                                ofile="${rfile}"
                                opath="${rpath}"
+                       else
+                               mv "${cfg_file}" "${rpath}/${ofile}"
+                               continue
                        fi
                done
        done