forked from docker/cli
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsync-branch
More file actions
executable file
·34 lines (28 loc) · 806 Bytes
/
Copy pathsync-branch
File metadata and controls
executable file
·34 lines (28 loc) · 806 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#!/usr/bin/env bash
# Merge the given release tags.
set -Eeuo pipefail
if [[ $# -lt 1 ]]; then
echo "usage: $0 TAG..." >&2
exit 1
fi
tags_to_sync=("$@")
for tag_to_sync in "${tags_to_sync[@]}"; do
if git merge --no-ff "$tag_to_sync"; then
continue
fi
if ! git rev-parse --verify --quiet MERGE_HEAD > /dev/null || git diff --quiet --diff-filter=U; then
exit 1
fi
git checkout "$tag_to_sync" -- '.'
git add --all
git merge --continue
done
# Check that every tag is in the branch.
# This catches cases where a merge did not actually incorporate one of the
# requested release tags.
for tag_to_sync in "${tags_to_sync[@]}"; do
if ! git merge-base --is-ancestor "$tag_to_sync" HEAD; then
echo "tag $tag_to_sync is not contained in $(git rev-parse --abbrev-ref HEAD)" >&2
exit 1
fi
done