Skip to content

Commit

Permalink
scripts/kernel_bump: Use the git index to find the needed config files
Browse files Browse the repository at this point in the history
The current solution using `find` introduces a racecondition, where `find`
and `git mv` get in each others way. While this could be fixed with
more-utils sponge command (or even sort -u) to buffer the output of
find.

However, a much better approach, is to query the git index directly,
which will not change, and is far more accurate.

Signed-off-by: Olliver Schinagl <oliver@schinagl.nl>
  • Loading branch information
oliv3r committed Mar 22, 2024
1 parent 4c35d65 commit e0ef875
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions scripts/kernel_bump.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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 [ ! -s "${_config}" ]; then
continue
fi

_subtarget="${_config%%"/config-${source_version}"}"
git mv "${_config}" "${_subtarget}/config-${target_version}"
done

git commit \
Expand Down

0 comments on commit e0ef875

Please sign in to comment.