From 9823a57d40bf197a32d321a84df56f56939ff949 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonas=20Bj=C3=B6rkert?= Date: Mon, 13 Jul 2026 12:05:32 +0200 Subject: [PATCH 1/2] Honor an optional submodule ref when fetching a customization submodule fetch_customization_submodule did a plain git clone of the default branch. If the .gitmodules entry a customization adds includes a 'branch' value, check it out after cloning (branch, tag, or SHA). Lets a customization pin a specific submodule version -- e.g. keep dev/main xdrip_cgm on the current plugin SHA while a next-dev variant points at a ported ref. No-op when unset (backward compatible). --- CustomizationSelect.sh | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/CustomizationSelect.sh b/CustomizationSelect.sh index 9498bf5..712798a 100755 --- a/CustomizationSelect.sh +++ b/CustomizationSelect.sh @@ -416,6 +416,15 @@ function fetch_customization_submodule { fi echo -e "${INFO_FONT} Fetching $sub_path, please wait ... patiently ...${NC}" if git clone --quiet "$sub_url" "$sub_path"; then + # Optional ref pin: if .gitmodules specifies a branch/tag/SHA for this + # submodule, check it out so a customization can lock a specific version + # (e.g. keep dev/main on one commit while next-dev uses another). + local sub_ref + sub_ref=$(git config -f .gitmodules --get "submodule.${sub_path}.branch" 2>/dev/null) + if [ -n "$sub_ref" ] && ! git -C "$sub_path" checkout --quiet "$sub_ref"; then + echo -e "${ERROR_FONT} Could not check out ref '$sub_ref' for $sub_path${NC}" + return 1 + fi erase_previous_line return 0 fi From cda5f2add572a44973aa61f2532ca2e0bc702b5a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonas=20Bj=C3=B6rkert?= Date: Mon, 13 Jul 2026 12:28:05 +0200 Subject: [PATCH 2/2] Put the ref-honoring in the source file The previous commit edited the generated CustomizationSelect.sh directly; move the change into its source (inline_functions/patch_functions.sh, inlined via src/CustomizationSelect.sh) so it survives ./build.sh. Regenerated output is identical. --- inline_functions/patch_functions.sh | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/inline_functions/patch_functions.sh b/inline_functions/patch_functions.sh index 3e2e0b2..4197899 100644 --- a/inline_functions/patch_functions.sh +++ b/inline_functions/patch_functions.sh @@ -245,6 +245,15 @@ function fetch_customization_submodule { fi echo -e "${INFO_FONT} Fetching $sub_path, please wait ... patiently ...${NC}" if git clone --quiet "$sub_url" "$sub_path"; then + # Optional ref pin: if .gitmodules specifies a branch/tag/SHA for this + # submodule, check it out so a customization can lock a specific version + # (e.g. keep dev/main on one commit while next-dev uses another). + local sub_ref + sub_ref=$(git config -f .gitmodules --get "submodule.${sub_path}.branch" 2>/dev/null) + if [ -n "$sub_ref" ] && ! git -C "$sub_path" checkout --quiet "$sub_ref"; then + echo -e "${ERROR_FONT} Could not check out ref '$sub_ref' for $sub_path${NC}" + return 1 + fi erase_previous_line return 0 fi