fix: skip push when local repo has no commits (empty clone)
The smoke test clones from an empty Forgejo repo, so there are no refs to push. Skip the push and verification gracefully when HEAD does not resolve. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
f8c8769af3
commit
26df57da18
1 changed files with 6 additions and 0 deletions
|
|
@ -674,6 +674,12 @@ push_to_forge() {
|
||||||
fi
|
fi
|
||||||
echo "Remote: forgejo -> ${display_url}"
|
echo "Remote: forgejo -> ${display_url}"
|
||||||
|
|
||||||
|
# Skip push if local repo has no commits (e.g. cloned from empty Forgejo repo)
|
||||||
|
if ! git -C "$repo_root" rev-parse HEAD >/dev/null 2>&1; then
|
||||||
|
echo "Push: skipped (local repo has no commits)"
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
|
||||||
# Push all branches and tags
|
# Push all branches and tags
|
||||||
echo "Pushing: branches to forgejo"
|
echo "Pushing: branches to forgejo"
|
||||||
if ! git -C "$repo_root" push forgejo --all 2>&1; then
|
if ! git -C "$repo_root" push forgejo --all 2>&1; then
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue