deletescript

package
v0.19.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 15, 2026 License: BSD-2-Clause Imports: 7 Imported by: 0

Documentation

Overview

Package deletescript renders the bash script that deletes abandoned branches. It only knows about branch names, last-commit dates and remotes — it has no notion of "abandoned" or "protected" branches. That analysis lives in the sync package, which decides which branches to report and hands this package the resulting values via RepoReport.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Generate

func Generate(workDir string, reports []RepoReport) (scriptPath string, err error)

Generate writes a shell script file that deletes every branch listed in reports and returns its path. It returns "" (with a nil error) when there is nothing to delete, so callers can treat an empty path as "no script was needed" rather than an error.

The return value uses named results so that a failure to close the script file (e.g. a delayed flush error on a lagging filesystem) is reported via err instead of being silently discarded, without masking any earlier, more specific error.

Types

type BranchInfo

type BranchInfo struct {
	Name              string
	LastCommit        time.Time
	RemotesWithBranch []string
}

BranchInfo holds the subset of branch metadata needed to emit the delete commands for a single branch: its name, when it was last touched, and which remotes still carry it.

type RepoReport

type RepoReport struct {
	RepoName string
	Regular  []BranchInfo
	Ignored  []BranchInfo
}

RepoReport holds the branches to delete for a single repository, already split into the "regular" and "ignored" (exclusion-pattern-matched) buckets used by the generated script's headers and review labels.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL