From dd02605ef196a83e7810a1b5547f4fcff7e81dca Mon Sep 17 00:00:00 2001 From: bryan Date: Tue, 23 Dec 2025 16:24:52 -0800 Subject: [PATCH] Track remote branches --- openwrtbuilder | 32 ++++++++++++++++++++++++++++++++ profiles | 29 +++++++++++++++-------------- 2 files changed, 47 insertions(+), 14 deletions(-) diff --git a/openwrtbuilder b/openwrtbuilder index 4e480aa..dc049d3 100755 --- a/openwrtbuilder +++ b/openwrtbuilder @@ -609,6 +609,38 @@ from_source() { execute git -C "$BUILD_DIR" merge-base --is-ancestor "$commit" HEAD || execute git -C "$BUILD_DIR" cherry-pick "$commit" done + + # Merge entire branches + for entry in ${P_ARR[branches]}; do + url_branch="$entry" + branch="" + url="$url_branch" + if [[ "$url_branch" == *"@"* ]]; then + url="${url_branch%@*}" + branch="${url_branch#*@}" + fi + + remote="${url%.git}" + remote="${remote##*/}" + remote=${remote//[^A-Za-z0-9._-]/_} + [[ -z $remote ]] && remote="merge" + + if ! git -C "$BUILD_DIR" remote | grep -q "^$remote$"; then + execute git -C "$BUILD_DIR" remote add "$remote" "$url" + else + execute git -C "$BUILD_DIR" remote set-url "$remote" "$url" + fi + + if [[ -n $branch ]]; then + execute git -C "$BUILD_DIR" fetch "$remote" "$branch" + echo "Merging $remote/$branch into $(git -C "$BUILD_DIR" rev-parse --abbrev-ref HEAD)" + execute git -C "$BUILD_DIR" merge --allow-unrelated-histories -m "Merge $remote/$branch" "$remote/$branch" || \ + { debug "Merge conflict or failed for $remote/$branch"; return 1; } + else + debug "Cannot merge: no branch specified in entry '$entry'" + continue + fi + done # Print commit info commit=$(git -C "$BUILD_DIR" rev-parse HEAD) diff --git a/profiles b/profiles index 807aebf..bae4846 100644 --- a/profiles +++ b/profiles @@ -81,20 +81,21 @@ declare -Ag w1700k=( smcroute avahi-daemon \ lm-sensors samba4-server luci-app-samba4 tailscale shadow-useradd \ ethtool ca-bundle tailscale" - [cherrypicks]="\ - https://github.com/OpenWRT-fanboy/OpenW1700k.git@lumos:8d449e968cfaa774ab7a219b3a5ab4251b2f9352 \ - https://github.com/OpenWRT-fanboy/OpenW1700k.git@lumos:3033241393ef6eb562539c6a3ccb9d3cf1a25d05 \ - https://github.com/OpenWRT-fanboy/OpenW1700k.git@lumos:79a21e0986a9efe6de3a07394a71ac15a2107b16 \ - https://github.com/OpenWRT-fanboy/OpenW1700k.git@lumos:2f8a1cbf901df0d325dfe112fdfe8013a72c8305 \ - https://github.com/OpenWRT-fanboy/OpenW1700k.git@lumos:71b09bc5852797cdbf7cb3b56a7d8fcd9d4ca9db \ - https://github.com/OpenWRT-fanboy/OpenW1700k.git@lumos:fe0135f0b7037a9cc1985d5937dd24cb99bfccb1 \ - https://github.com/OpenWRT-fanboy/OpenW1700k.git@lumos:cdb937180fb971fe702078f0e0fef63f2fcce337 \ - https://github.com/OpenWRT-fanboy/OpenW1700k.git@lumos:6dc847c802b9dc597fc2c64711ca85499f128d1d \ - https://github.com/OpenWRT-fanboy/OpenW1700k.git@lumos:b6e6cf911915dd987eecde908a2013419565cff4 \ - https://github.com/OpenWRT-fanboy/OpenW1700k.git@lumos:708089948949e66f5234249fc631e0453b58942e \ - https://github.com/OpenWRT-fanboy/OpenW1700k.git@lumos:9841a707a577385498591bcfb56b836176325c2f \ - https://github.com/OpenWRT-fanboy/OpenW1700k.git@lumos:8446ec6431a3247683a27070d3c69f2789b52c70 \ - https://github.com/OpenWRT-fanboy/OpenW1700k.git@lumos:05380e2ef5fb96c171da23453ba32aa349a4b126" + # [cherrypicks]="\ + # https://github.com/OpenWRT-fanboy/OpenW1700k.git@lumos:8d449e968cfaa774ab7a219b3a5ab4251b2f9352 \ + # https://github.com/OpenWRT-fanboy/OpenW1700k.git@lumos:3033241393ef6eb562539c6a3ccb9d3cf1a25d05 \ + # https://github.com/OpenWRT-fanboy/OpenW1700k.git@lumos:79a21e0986a9efe6de3a07394a71ac15a2107b16 \ + # https://github.com/OpenWRT-fanboy/OpenW1700k.git@lumos:2f8a1cbf901df0d325dfe112fdfe8013a72c8305 \ + # https://github.com/OpenWRT-fanboy/OpenW1700k.git@lumos:71b09bc5852797cdbf7cb3b56a7d8fcd9d4ca9db \ + # https://github.com/OpenWRT-fanboy/OpenW1700k.git@lumos:fe0135f0b7037a9cc1985d5937dd24cb99bfccb1 \ + # https://github.com/OpenWRT-fanboy/OpenW1700k.git@lumos:cdb937180fb971fe702078f0e0fef63f2fcce337 \ + # https://github.com/OpenWRT-fanboy/OpenW1700k.git@lumos:6dc847c802b9dc597fc2c64711ca85499f128d1d \ + # https://github.com/OpenWRT-fanboy/OpenW1700k.git@lumos:b6e6cf911915dd987eecde908a2013419565cff4 \ + # https://github.com/OpenWRT-fanboy/OpenW1700k.git@lumos:708089948949e66f5234249fc631e0453b58942e \ + # https://github.com/OpenWRT-fanboy/OpenW1700k.git@lumos:9841a707a577385498591bcfb56b836176325c2f \ + # https://github.com/OpenWRT-fanboy/OpenW1700k.git@lumos:8446ec6431a3247683a27070d3c69f2789b52c70 \ + # https://github.com/OpenWRT-fanboy/OpenW1700k.git@lumos:05380e2ef5fb96c171da23453ba32aa349a4b126" + [branches]="https://github.com/OpenWRT-fanboy/OpenW1700k.git@lumos" ) declare -Ag rpi4=(