Skip to content

Commit 0b8b027

Browse files
committed
Sync script: handle multi commit merges
Signed-off-by: Todd Short <[email protected]>
1 parent 8d6f8c4 commit 0b8b027

File tree

3 files changed

+8
-7
lines changed

3 files changed

+8
-7
lines changed

scripts/sync.sh

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ fetch_remote() {
2929

3030
new_candidate_branch() {
3131
echo "Creating a sync branch if it doesn't already exist"
32-
git checkout -b "$SYNC_BRANCH_NAME" upstream/master 2>/dev/null || git checkout "$SYNC_BRANCH_NAME"
32+
git checkout -b "$SYNC_BRANCH_NAME" master 2>/dev/null || git checkout "$SYNC_BRANCH_NAME"
3333
}
3434

3535
candidates() {
@@ -50,13 +50,13 @@ pop() {
5050
}
5151

5252
check_local_branch_commit_diff() {
53-
commits_ahead=$(git rev-list upstream/master..HEAD | wc -l)
53+
commits_ahead=$(git rev-list master..HEAD | wc -l)
5454

5555
if [[ "$commits_ahead" -gt 1 ]]; then
5656
# TODO: automatically open a new pull request here.
57-
echo "The local sync branch is $commits_ahead commits ahead of the upstream/master branch"
57+
echo "The local sync branch is $commits_ahead commits ahead of the master branch"
5858
else
59-
echo "No sync PR is needed as the upstream/master branch is up-to-date"
59+
echo "No sync PR is needed as the master branch is up-to-date"
6060
fi
6161
}
6262

scripts/sync_get_candidates.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,8 @@ cherrypick_set="${remote}.cherrypick"
4949
: > "${cherrypick_set}" # clear existing file
5050
for rc in "${remote_commits[@]}"; do
5151
if [[ -z $(git log -n 1 --no-merges --grep "${rc}" HEAD) && -z $(grep "${rc}" "${remote}.blacklist") ]]; then
52-
git show -s --format="%cI ${remote} %H" "${rc}" >> "${cherrypick_set}"
52+
53+
git show -s --format="%cI $(printf "%03d" ${picked}) ${remote} %H" "${rc}" >> "${cherrypick_set}"
5354
(( ++picked ))
5455
fi
5556
done

scripts/sync_pop_candidate.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,9 +57,9 @@ function pop() {
5757
exit
5858
fi
5959
readarray -t rcs < <(echo "$rc" | tr " " "\n")
60-
remote="${rcs[1]}"
60+
remote="${rcs[2]}"
6161
subtree_dir="staging/${remote}"
62-
rc="${rcs[2]}"
62+
rc="${rcs[3]}"
6363
printf 'popping: %s\n' "${rc}"
6464

6565
# Cherrypick the commit

0 commit comments

Comments
 (0)