fix(dolt): recognize shim hooks as Dolt-compatible
Shim hooks (bd-shim marker) delegate to 'bd hook' command which already handles Dolt backend correctly. Update both doctor check and migration warning to recognize shim hooks as OK. Only inline hooks (older style with embedded logic) need the explicit Dolt backend check in the shell script. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -800,7 +800,16 @@ func CheckGitHooksDoltCompatibility(path string) DoctorCheck {
|
||||
|
||||
contentStr := string(content)
|
||||
|
||||
// Check if it's a bd hook
|
||||
// Shim hooks (bd-shim) delegate to 'bd hook' which handles Dolt correctly
|
||||
if strings.Contains(contentStr, bdShimMarker) {
|
||||
return DoctorCheck{
|
||||
Name: "Git Hooks Dolt Compatibility",
|
||||
Status: StatusOK,
|
||||
Message: "Shim hooks (Dolt handled by bd hook command)",
|
||||
}
|
||||
}
|
||||
|
||||
// Check if it's a bd inline hook
|
||||
if !strings.Contains(contentStr, bdInlineHookMarker) && !strings.Contains(contentStr, "bd") {
|
||||
return DoctorCheck{
|
||||
Name: "Git Hooks Dolt Compatibility",
|
||||
@@ -809,12 +818,12 @@ func CheckGitHooksDoltCompatibility(path string) DoctorCheck {
|
||||
}
|
||||
}
|
||||
|
||||
// Check if it has the Dolt backend skip logic
|
||||
// Check if inline hook has the Dolt backend skip logic
|
||||
if strings.Contains(contentStr, `"backend"`) && strings.Contains(contentStr, `"dolt"`) {
|
||||
return DoctorCheck{
|
||||
Name: "Git Hooks Dolt Compatibility",
|
||||
Status: StatusOK,
|
||||
Message: "Hooks have Dolt backend check",
|
||||
Message: "Inline hooks have Dolt backend check",
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -172,16 +172,24 @@ func hooksNeedDoltUpdate(beadsDir string) bool {
|
||||
return false // No hook installed
|
||||
}
|
||||
|
||||
// Check if it's a bd hook and lacks the Dolt skip logic
|
||||
contentStr := string(content)
|
||||
|
||||
// Shim hooks (bd-shim) delegate to 'bd hook' which handles Dolt correctly
|
||||
if strings.Contains(contentStr, "bd-shim") {
|
||||
return false // Shim hooks are fine
|
||||
}
|
||||
|
||||
// Check if it's a bd inline hook
|
||||
if !strings.Contains(contentStr, "bd") {
|
||||
return false // Not a bd hook
|
||||
}
|
||||
|
||||
// Check if inline hook has the Dolt skip logic
|
||||
if strings.Contains(contentStr, `"backend"`) && strings.Contains(contentStr, `"dolt"`) {
|
||||
return false // Already has Dolt check
|
||||
}
|
||||
|
||||
return true // bd hook without Dolt check
|
||||
return true // bd inline hook without Dolt check
|
||||
}
|
||||
|
||||
// handleToSQLiteMigration migrates from Dolt to SQLite backend (escape hatch).
|
||||
|
||||
Reference in New Issue
Block a user