fix(refinery): use mayor/rig fallback for correct git remote
Refinery was using rig.Path which found the town's .git with rig-named remotes (e.g., 'gastown') instead of 'origin'. This caused refinery to miss polecat branches when fetching. Now falls back to mayor/rig (which has 'origin' pointing to the project repo) when refinery/rig doesn't exist. Fixes: hq-uvrzt
This commit is contained in:
@@ -94,13 +94,21 @@ func NewEngineer(r *rig.Rig) *Engineer {
|
|||||||
// Override target branch with rig's configured default branch
|
// Override target branch with rig's configured default branch
|
||||||
cfg.TargetBranch = r.DefaultBranch()
|
cfg.TargetBranch = r.DefaultBranch()
|
||||||
|
|
||||||
|
// Determine the git working directory for refinery operations.
|
||||||
|
// Prefer refinery/rig worktree, fall back to mayor/rig (legacy architecture).
|
||||||
|
// Using rig.Path directly would find town's .git with rig-named remotes instead of "origin".
|
||||||
|
gitDir := filepath.Join(r.Path, "refinery", "rig")
|
||||||
|
if _, err := os.Stat(gitDir); os.IsNotExist(err) {
|
||||||
|
gitDir = filepath.Join(r.Path, "mayor", "rig")
|
||||||
|
}
|
||||||
|
|
||||||
return &Engineer{
|
return &Engineer{
|
||||||
rig: r,
|
rig: r,
|
||||||
beads: beads.New(r.Path),
|
beads: beads.New(r.Path),
|
||||||
mrQueue: mrqueue.New(r.Path),
|
mrQueue: mrqueue.New(r.Path),
|
||||||
git: git.NewGit(r.Path),
|
git: git.NewGit(gitDir),
|
||||||
config: cfg,
|
config: cfg,
|
||||||
workDir: r.Path,
|
workDir: gitDir,
|
||||||
output: os.Stdout,
|
output: os.Stdout,
|
||||||
eventLogger: mrqueue.NewEventLoggerFromRig(r.Path),
|
eventLogger: mrqueue.NewEventLoggerFromRig(r.Path),
|
||||||
router: mail.NewRouter(r.Path),
|
router: mail.NewRouter(r.Path),
|
||||||
|
|||||||
@@ -162,8 +162,9 @@ func (m *Manager) Start(foreground bool) error {
|
|||||||
// Working directory is the refinery worktree (shares .git with mayor/polecats)
|
// Working directory is the refinery worktree (shares .git with mayor/polecats)
|
||||||
refineryRigDir := filepath.Join(m.rig.Path, "refinery", "rig")
|
refineryRigDir := filepath.Join(m.rig.Path, "refinery", "rig")
|
||||||
if _, err := os.Stat(refineryRigDir); os.IsNotExist(err) {
|
if _, err := os.Stat(refineryRigDir); os.IsNotExist(err) {
|
||||||
// Fall back to rig path if refinery/rig doesn't exist
|
// Fall back to mayor/rig (legacy architecture) - ensures we use project git, not town git.
|
||||||
refineryRigDir = m.workDir
|
// Using rig.Path directly would find town's .git with rig-named remotes instead of "origin".
|
||||||
|
refineryRigDir = filepath.Join(m.rig.Path, "mayor", "rig")
|
||||||
}
|
}
|
||||||
|
|
||||||
// Ensure runtime settings exist in refinery/ (not refinery/rig/) so we don't
|
// Ensure runtime settings exist in refinery/ (not refinery/rig/) so we don't
|
||||||
|
|||||||
Reference in New Issue
Block a user