refactor: remove unused bd pin/unpin/hook commands (bd-x0zl)
Analysis found these commands are dead code: - gt never calls `bd pin` - uses `bd update --status=pinned` instead - Beads.Pin() wrapper exists but is never called - bd hook functionality duplicated by gt mol status - Code comment says "pinned field is cosmetic for bd hook visibility" Removed: - cmd/bd/pin.go - cmd/bd/unpin.go - cmd/bd/hook.go 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -7,6 +7,7 @@ import (
|
||||
"testing"
|
||||
|
||||
"github.com/steveyegge/beads/internal/config"
|
||||
"github.com/steveyegge/beads/internal/git"
|
||||
|
||||
// Import SQLite driver for test database creation
|
||||
_ "github.com/ncruces/go-sqlite3/driver"
|
||||
@@ -70,14 +71,20 @@ func TestShouldDisableDaemonForWorktree(t *testing.T) {
|
||||
|
||||
// Change to the worktree directory
|
||||
origDir, _ := os.Getwd()
|
||||
defer func() {
|
||||
defer func() {
|
||||
_ = os.Chdir(origDir)
|
||||
// Reset git caches after changing directory
|
||||
git.ResetCaches()
|
||||
// Reinitialize config to restore original state
|
||||
_ = config.Initialize()
|
||||
}()
|
||||
if err := os.Chdir(worktreeDir); err != nil {
|
||||
t.Fatalf("Failed to change to worktree dir: %v", err)
|
||||
}
|
||||
git.ResetCaches()
|
||||
|
||||
// Reset git caches after changing directory (required for IsWorktree to re-detect)
|
||||
git.ResetCaches()
|
||||
|
||||
// No sync-branch configured
|
||||
os.Unsetenv("BEADS_SYNC_BRANCH")
|
||||
@@ -106,13 +113,18 @@ func TestShouldDisableDaemonForWorktree(t *testing.T) {
|
||||
|
||||
// Change to the worktree directory
|
||||
origDir, _ := os.Getwd()
|
||||
defer func() {
|
||||
defer func() {
|
||||
_ = os.Chdir(origDir)
|
||||
git.ResetCaches()
|
||||
_ = config.Initialize()
|
||||
}()
|
||||
if err := os.Chdir(worktreeDir); err != nil {
|
||||
t.Fatalf("Failed to change to worktree dir: %v", err)
|
||||
}
|
||||
git.ResetCaches()
|
||||
|
||||
// Reset git caches after changing directory
|
||||
git.ResetCaches()
|
||||
|
||||
// Reinitialize config to pick up the new directory's config.yaml
|
||||
if err := config.Initialize(); err != nil {
|
||||
@@ -137,13 +149,18 @@ func TestShouldDisableDaemonForWorktree(t *testing.T) {
|
||||
|
||||
// Change to the worktree directory
|
||||
origDir, _ := os.Getwd()
|
||||
defer func() {
|
||||
defer func() {
|
||||
_ = os.Chdir(origDir)
|
||||
git.ResetCaches()
|
||||
_ = config.Initialize()
|
||||
}()
|
||||
if err := os.Chdir(worktreeDir); err != nil {
|
||||
t.Fatalf("Failed to change to worktree dir: %v", err)
|
||||
}
|
||||
git.ResetCaches()
|
||||
|
||||
// Reset git caches after changing directory
|
||||
git.ResetCaches()
|
||||
|
||||
// Reinitialize config to pick up the new directory's config.yaml
|
||||
if err := config.Initialize(); err != nil {
|
||||
@@ -187,13 +204,18 @@ func TestShouldAutoStartDaemonWorktreeIntegration(t *testing.T) {
|
||||
|
||||
// Change to the worktree directory
|
||||
origDir, _ := os.Getwd()
|
||||
defer func() {
|
||||
defer func() {
|
||||
_ = os.Chdir(origDir)
|
||||
git.ResetCaches()
|
||||
_ = config.Initialize()
|
||||
}()
|
||||
if err := os.Chdir(worktreeDir); err != nil {
|
||||
t.Fatalf("Failed to change to worktree dir: %v", err)
|
||||
}
|
||||
git.ResetCaches()
|
||||
|
||||
// Reset git caches after changing directory
|
||||
git.ResetCaches()
|
||||
|
||||
// Clear all daemon-related env vars
|
||||
os.Unsetenv("BEADS_NO_DAEMON")
|
||||
@@ -220,13 +242,18 @@ func TestShouldAutoStartDaemonWorktreeIntegration(t *testing.T) {
|
||||
|
||||
// Change to the worktree directory
|
||||
origDir, _ := os.Getwd()
|
||||
defer func() {
|
||||
defer func() {
|
||||
_ = os.Chdir(origDir)
|
||||
git.ResetCaches()
|
||||
_ = config.Initialize()
|
||||
}()
|
||||
if err := os.Chdir(worktreeDir); err != nil {
|
||||
t.Fatalf("Failed to change to worktree dir: %v", err)
|
||||
}
|
||||
git.ResetCaches()
|
||||
|
||||
// Reset git caches after changing directory
|
||||
git.ResetCaches()
|
||||
|
||||
// Reinitialize config to pick up the new directory's config.yaml
|
||||
if err := config.Initialize(); err != nil {
|
||||
@@ -253,13 +280,18 @@ func TestShouldAutoStartDaemonWorktreeIntegration(t *testing.T) {
|
||||
|
||||
// Change to the worktree directory
|
||||
origDir, _ := os.Getwd()
|
||||
defer func() {
|
||||
defer func() {
|
||||
_ = os.Chdir(origDir)
|
||||
git.ResetCaches()
|
||||
_ = config.Initialize()
|
||||
}()
|
||||
if err := os.Chdir(worktreeDir); err != nil {
|
||||
t.Fatalf("Failed to change to worktree dir: %v", err)
|
||||
}
|
||||
git.ResetCaches()
|
||||
|
||||
// Reset git caches after changing directory
|
||||
git.ResetCaches()
|
||||
|
||||
// Reinitialize config to pick up the new directory's config.yaml
|
||||
if err := config.Initialize(); err != nil {
|
||||
@@ -302,8 +334,8 @@ func setupWorktreeTestRepo(t *testing.T) (mainDir, worktreeDir string) {
|
||||
// Create main repo directory
|
||||
mainDir = t.TempDir()
|
||||
|
||||
// Initialize git repo
|
||||
cmd := exec.Command("git", "init")
|
||||
// Initialize git repo with 'main' as default branch (modern git convention)
|
||||
cmd := exec.Command("git", "init", "--initial-branch=main")
|
||||
cmd.Dir = mainDir
|
||||
if output, err := cmd.CombinedOutput(); err != nil {
|
||||
t.Fatalf("Failed to init git repo: %v\n%s", err, output)
|
||||
|
||||
Reference in New Issue
Block a user