scripts/kernel_bump: Use the git index to find the needed config files
[openwrt/openwrt.git] / scripts / kernel_bump.sh
index d9fc5287dfccf017d1ce39ad72a3125d685cdb57..7ce3b6256f6e964f4db5bc95c6d0ec4c23c991e6 100755 (executable)
@@ -137,9 +137,15 @@ bump_kernel()
                done
        fi
 
-       find "${_target_dir}" -iname "config-${source_version}" | while read -r _config; do
-               _path="${_config%%"/config-${source_version}"}"
-               git mv "${_config}" "${_path}/config-${target_version}"
+       for _config in $(git ls-files "${_target_dir}" |
+                        sed -n "s|^\(.*config-${source_version}\).*|\1|p" |
+                        sort -u); do
+               if [ ! -e "${_config}" ]; then
+                       continue
+               fi
+
+               _subtarget="${_config%%"/config-${source_version}"}"
+               git mv "${_config}" "${_subtarget}/config-${target_version}"
        done
 
        git commit \