From 371cf5f0cd52e336584ad95a0da8b68260902182 Mon Sep 17 00:00:00 2001 From: Rob Decker Date: Tue, 10 Mar 2026 18:16:13 -0700 Subject: [PATCH] fix: use path-specific commit message in sync script Use the most recent commit that touched the synced path instead of the latest commit in the repo. Falls back to latest commit if no path-specific commit is found. Co-Authored-By: Claude Opus 4.6 --- MAINTAINING.md | 6 +++--- scripts/sync-repo.sh | 5 ++++- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/MAINTAINING.md b/MAINTAINING.md index 62d32168..26344f68 100644 --- a/MAINTAINING.md +++ b/MAINTAINING.md @@ -26,7 +26,7 @@ While maintaining releases for packages, starters and examples is done with Lern "sync:modules": "./scripts/sync-repo.sh 3.x git@git.drupal.org:project/ \"modules/*\"", ``` -2. Run `yarn sync:modules` to sync the latest commit on `main` with the git repo on drupal.org. All recent changes will be squashed into a commit using the latest commit message. +2. Run `yarn sync:modules` to sync the latest commit on `main` with the git repo on drupal.org. All recent changes will be squashed into a commit using the most recent commit message that touched the synced path. 3. On Drupal.org’s GitLab, [tag a release](https://git.drupalcode.org/project/next/-/tags/new) following the [“Release tags naming conventions” docs](https://www.drupal.org/docs/develop/git/git-for-drupal-project-maintainers/release-naming-conventions#release-tags). @@ -131,7 +131,7 @@ The code in the examples repos do not strictly require a versioned release since yarn sync:examples ``` - All recent changes on `main` will be squashed into a commit on the target git repo using the latest commit message. + All recent changes on `main` will be squashed into a commit on the target git repo using the most recent commit message that touched the synced path. ### Starters @@ -158,7 +158,7 @@ The code in the examples repos do not strictly require a versioned release since yarn sync:starters:release ``` - All recent changes on `main` will be squashed into a commit on the target git repo using the latest commit message. + All recent changes on `main` will be squashed into a commit on the target git repo using the most recent commit message that touched the synced path. 4. **Create a GitHub release and tag** diff --git a/scripts/sync-repo.sh b/scripts/sync-repo.sh index 9ce68d1e..10c9a86a 100755 --- a/scripts/sync-repo.sh +++ b/scripts/sync-repo.sh @@ -15,7 +15,10 @@ BRANCH=$(echo $BRANCHES | cut -d "," -f 1) TRACKING_BRANCH=$(echo $BRANCHES | cut -d "," -f 2) BASE=$(pwd) -COMMIT_MESSAGE=$(git log -1 --pretty=%B) +COMMIT_MESSAGE=$(git log -1 --pretty=%B -- $GLOB) +if [ -z "$COMMIT_MESSAGE" ]; then + COMMIT_MESSAGE=$(git log -1 --pretty=%B) +fi for folder in $GLOB; do [ -d "$folder" ] || continue