From bfc52a37f0650e0d8cf727f5998882a3bcebbe0c Mon Sep 17 00:00:00 2001 From: Paul Buetow Date: Tue, 24 Jun 2025 01:21:35 +0300 Subject: feat: add abandoned branch detection and reporting MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Automatically detects and reports abandoned branches during sync operations: - Branches are considered abandoned if they have no commits for 6+ months - Only reports on active repositories (main/master updated within last year) - Shows individual reports during sync of each repository - Displays comprehensive summary after sync-all operations - Provides helpful cleanup commands for removing old branches This helps maintain cleaner repositories by identifying stale branches that may no longer be needed. Example output: 🔍 Abandoned branches in dtail: Main branch last updated: 2025-04-17 Found 1 abandoned branches (no commits for 6+ months): - develop (last commit: 2023-10-05, No commits for 628 days) 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude --- internal/cli/sync_handlers.go | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'internal/cli') diff --git a/internal/cli/sync_handlers.go b/internal/cli/sync_handlers.go index d14255e..dd0dcf9 100644 --- a/internal/cli/sync_handlers.go +++ b/internal/cli/sync_handlers.go @@ -66,6 +66,12 @@ func HandleSyncAll(cfg *config.Config, flags *Flags) int { } fmt.Printf("\nSuccessfully synced all %d repositories!\n", successCount) + + // Print abandoned branches summary + if summary := syncer.GenerateAbandonedBranchSummary(); summary != "" { + fmt.Print(summary) + } + return 0 } @@ -269,6 +275,11 @@ func syncCodebergRepos(cfg *config.Config, flags *Flags, repos []codeberg.Reposi fmt.Printf("\n=== Summary ===\n") fmt.Printf("Successfully synced: %d repositories\n", successCount) + // Print abandoned branches summary + if summary := syncer.GenerateAbandonedBranchSummary(); summary != "" { + fmt.Print(summary) + } + if !flags.SyncGitHubPublic { return 0 } @@ -304,6 +315,11 @@ func syncGitHubRepos(cfg *config.Config, flags *Flags, repos []github.Repository fmt.Printf("\n=== Summary ===\n") fmt.Printf("Successfully synced: %d repositories\n", successCount) + // Print abandoned branches summary + if summary := syncer.GenerateAbandonedBranchSummary(); summary != "" { + fmt.Print(summary) + } + return 0 } -- cgit v1.2.3