fix: finalize metadata after commit, not after push (GH#885)
In performExport, if git commit succeeded but push failed, the finalizeExportMetadata() was never called because we returned early. This meant metadata would not reflect the successful export+commit. Now finalize is called: - Right after syncBranchCommitAndPush succeeds - Right after gitCommit succeeds (before push attempt) - When no git changes exist (export still happened) Push failure still returns early, but metadata is already updated. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> Executed-By: beads/crew/dave Rig: beads Role: crew
This commit is contained in:
committed by
Steve Yegge
parent
a1079fcbe1
commit
f92090344a
@@ -474,8 +474,11 @@ func performExport(ctx context.Context, store storage.Storage, autoCommit, autoP
|
||||
return
|
||||
}
|
||||
|
||||
// If sync branch not configured, use regular commit
|
||||
if !committed {
|
||||
if committed {
|
||||
// GH#885: Finalize after sync branch commit succeeded
|
||||
finalizeExportMetadata()
|
||||
} else {
|
||||
// If sync branch not configured, use regular commit
|
||||
hasChanges, err := gitHasChanges(exportCtx, jsonlPath)
|
||||
if err != nil {
|
||||
log.log("Error checking git status: %v", err)
|
||||
@@ -490,6 +493,10 @@ func performExport(ctx context.Context, store storage.Storage, autoCommit, autoP
|
||||
}
|
||||
log.log("Committed changes")
|
||||
|
||||
// GH#885: Finalize after git commit succeeded, before push
|
||||
// Push failure shouldn't prevent metadata update since commit succeeded
|
||||
finalizeExportMetadata()
|
||||
|
||||
// Auto-push if enabled (GH#872: use sync.remote config)
|
||||
if autoPush {
|
||||
configuredRemote, _ := store.GetConfig(exportCtx, "sync.remote")
|
||||
@@ -499,11 +506,11 @@ func performExport(ctx context.Context, store storage.Storage, autoCommit, autoP
|
||||
}
|
||||
log.log("Pushed to remote")
|
||||
}
|
||||
} else {
|
||||
// No git changes but export happened - finalize metadata
|
||||
finalizeExportMetadata()
|
||||
}
|
||||
}
|
||||
|
||||
// GH#885: NOW finalize metadata after git commit succeeded
|
||||
finalizeExportMetadata()
|
||||
} else if skipGit {
|
||||
// Git-free mode: finalize immediately since there's no git to wait for
|
||||
finalizeExportMetadata()
|
||||
|
||||
Reference in New Issue
Block a user