Skip to content

Commit f8dcc66

Browse files
committed
Default to not sync tags every time, added --rebuild-tags flag
This should speed up the time it takes to publish changes. New tags that were not previously available will be synced but any tag that has already been synced should be skipped. Fixes #1
1 parent 9d5e3e0 commit f8dcc66

2 files changed

Lines changed: 17 additions & 0 deletions

File tree

README.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,15 @@ tags the upstream repository knows about.
103103
Do not sync any tags.
104104

105105

106+
#### --rebuild-tags
107+
108+
Ordinarily tags will not be synced more than once. This is because in general
109+
tags should be considered or or less static.
110+
111+
If for some reason tags need to be resynced from scratch (history changed so
112+
tags might point to somewhere else) this flag will get the job done.
113+
114+
106115
#### -q,--quiet
107116

108117
As little output as possible.

git-subsplit.sh

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ no-heads do not publish any heads
2424
tags= only publish for listed tags instead of all tags
2525
no-tags do not publish any tags
2626
update fetch updates from repository before publishing
27+
rebuild-tags rebuild all tags (as opposed to skipping tags that are already synced)
2728
"
2829
eval "$(echo "$OPTS_SPEC" | git rev-parse --parseopt -- "$@" || echo exit $?)"
2930

@@ -49,6 +50,7 @@ REPO_URL=
4950
WORK_DIR="${PWD}/.subsplit"
5051
HEADS=
5152
TAGS=
53+
REBUILD_TAGS=
5254
DRY_RUN=
5355

5456
subsplit_main()
@@ -65,6 +67,7 @@ subsplit_main()
6567
--update) UPDATE=1 ;;
6668
-n) DRY_RUN="--dry-run" ;;
6769
--dry-run) DRY_RUN="--dry-run" ;;
70+
--rebuild-tags) REBUILD_TAGS=1 ;;
6871
--) break ;;
6972
*) die "Unexpected option: $opt" ;;
7073
esac
@@ -178,6 +181,11 @@ subsplit_publish()
178181
for TAG in $TAGS
179182
do
180183
LOCAL_TAG="${REMOTE_NAME}-tag-${TAG}"
184+
if git branch | grep "${LOCAL_TAG}$" >/dev/null && [ -z "$REBUILD_TAGS" ]
185+
then
186+
say " - skpping tag ${TAG} (already synced)"
187+
continue
188+
fi
181189
say " - syncing tag ${TAG}"
182190
git branch -D "$LOCAL_TAG" >/dev/null 2>&1
183191
git subtree split -q --annotate="${ANNOTATE}" --prefix="$SUBPATH" --branch="$LOCAL_TAG" "$TAG" >/dev/null 2>&1

0 commit comments

Comments
 (0)