-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathsync-upstream.sh
More file actions
executable file
·36 lines (31 loc) · 1.29 KB
/
Copy pathsync-upstream.sh
File metadata and controls
executable file
·36 lines (31 loc) · 1.29 KB
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
35
36
#!/usr/bin/env bash
# check codeberg for new upstream gadgetbridge commits, and optionally replay pulse on top.
# usage: ./sync-upstream.sh just report what's new (safe, default)
# ./sync-upstream.sh --rebase actually rebase pulse onto upstream/master
set -e
cd "$(dirname "$0")"
git fetch upstream master
BASE=$(git merge-base HEAD upstream/master)
N=$(git rev-list --count "$BASE"..upstream/master)
if [ "$N" -eq 0 ]; then
echo "already up to date with upstream."
exit 0
fi
echo "== $N new upstream commits =="
git log --oneline "$BASE"..upstream/master
echo
echo "== of those, ones touching garmin / files we changed =="
git log --oneline "$BASE"..upstream/master -- \
'app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/garmin/**' \
'app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/garmin/**' \
$(git diff --name-only "$BASE"..HEAD | tr '\n' ' ') || true
if [ "$1" != "--rebase" ]; then
echo
echo "(report only. run with --rebase to replay pulse onto upstream.)"
exit 0
fi
echo
echo "rebasing pulse onto upstream/master… (on conflict: fix files, git add, git rebase --continue;"
echo " or bail with git rebase --abort)"
git rebase upstream/master
echo "rebased. build + deploy when happy: ./deploy.sh \"sync upstream\""