scripts: Kernel bumper script
authorOlliver Schinagl <oliver@schinagl.nl>
Fri, 23 Feb 2024 21:54:48 +0000 (22:54 +0100)
committerRobert Marko <robimarko@gmail.com>
Mon, 11 Mar 2024 08:53:01 +0000 (09:53 +0100)
commit3561015efdfb3a6c268f723f509f5cd2720efdb8
tree9ff077d1226da0685bbefc632dbd482264c18c7a
parent1a6954337634474e6c42dec6023daa7af1d52432
scripts: Kernel bumper script

For years, we have struggled and been frustrated at loosing history of
files in git, due to the 'copy + add' strategy. This could have been
prevented with a double-commit 'mv + add' trick.

On the mailing list [0] the discussion was started to put the
instructions in a wiki. Instead, it is much better to just script it and
put it in the repo.

Instead of doing mv + copy, which leads to two commits, but no history
on the copied files, it uses move, + copy and merge, which results in
three (merge) commits, but keeps the history of all files. As always
with renames, `--follow` will be needed.

The tool is trivial and works either in the OpenWrt git root directory,
or in the actual target directory.

Tested on the `realtek` and generic targets.

Note, that the tool does not do any of the labor needed after the move,
such as updating configs, dropping patches etc.

To make sure this script is easily found by any developer, who just
wants to do a kernel bump, the script is added here and not to
maintainer-tools repo as those scripts are a little bit more specialized.
Bumping a kernel is a trivial task that often regular developers do,
where most do not even know the existence of maintainer tools, are not
part of the main repo they'd clone, not part of the docker container
they'd use and so discoverability is probably much more important.

[0]: https://lists.openwrt.org/pipermail/openwrt-devel/2023-October/041673.html

Signed-off-by: Olliver Schinagl <oliver@schinagl.nl>
Tested-by: Robert Marko <robimarko@gmail.com>
Tested-by: Weijie Gao <hackpascal@gmail.com>
scripts/kernel_bump.sh [new file with mode: 0755]