Skip to content

Commit 0f9c519

Browse files
yarikopticclaude
andcommitted
Fix git-bug sync: fetch/push identity refs, handle missing identities
Bug refs reference identity objects stored under refs/identities/*. Without identity refs, git-bug cache build fails with "identity doesn't exist" on every command. Fix by: - Fetching both refs/bugs/* and refs/identities/* from remote - Detecting missing identity refs and wiping orphaned bug refs so that the pull starts fresh (data is re-pulled from GitHub) - Pushing both ref namespaces so subsequent runs can be incremental Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent d268ca5 commit 0f9c519

1 file changed

Lines changed: 13 additions & 3 deletions

File tree

.github/workflows/sync-git-bug.yml

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,19 @@ jobs:
2626
git config --global user.name "github-actions"
2727
git config --global user.email "github-actions@users.noreply.github.com"
2828
29-
30-
- name: Fetch existing bug refs
29+
- name: Fetch existing git-bug refs
3130
run: |
31+
# Fetch both bugs and identities; bug refs are unusable without
32+
# their corresponding identity refs (git-bug cache build fails).
3233
git fetch origin 'refs/bugs/*:refs/bugs/*' || true
34+
git fetch origin 'refs/identities/*:refs/identities/*' || true
35+
# If identity refs are missing, wipe fetched bug refs to avoid
36+
# "identity doesn't exist" errors during cache build.
37+
if [ -z "$(git for-each-ref refs/identities/)" ]; then
38+
echo "No identity refs found on remote; wiping bug refs to start fresh"
39+
git for-each-ref --format='%(refname)' refs/bugs/ \
40+
| xargs -r -n1 git update-ref -d || true
41+
fi
3342
3443
- name: Install git-bug
3544
run: |
@@ -60,6 +69,7 @@ jobs:
6069
- name: Pull issues from GitHub
6170
run: git-bug bridge pull github
6271

63-
- name: Push bug refs to origin
72+
- name: Push git-bug refs to origin
6473
run: |
6574
git push origin 'refs/bugs/*:refs/bugs/*'
75+
git push origin 'refs/identities/*:refs/identities/*'

0 commit comments

Comments
 (0)