config

package
v14.2.0 Latest Latest
Warning

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

Go to latest
Published: Apr 24, 2024 License: MIT Imports: 12 Imported by: 0

Documentation

Overview

Package config provides functionality to read and write the Git Town configuration. Git Town configuration can exist in a number of locations: in local or global Git metadata or in a configuration file. Subspackages implement access to specific configuration locations.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	ConfigFile      *configdomain.PartialConfig // content of git-town.toml, nil = no config file exists
	DryRun          bool
	FullConfig      configdomain.FullConfig    // the merged configuration data
	GitConfig       gitconfig.Access           // access to the Git configuration settings
	GlobalGitConfig configdomain.PartialConfig // content of the global Git configuration
	LocalGitConfig  configdomain.PartialConfig // content of the local Git configuration
	// contains filtered or unexported fields
}

Config provides type-safe access to Git Town configuration settings stored in the local and global Git configuration.

func NewConfig

func NewConfig(args NewConfigArgs) (*Config, *stringslice.Collector, error)

func (*Config) AddToContributionBranches

func (self *Config) AddToContributionBranches(branches ...gitdomain.LocalBranchName) error

AddToContributionBranches registers the given branch names as perennial branches. The branches must exist.

func (*Config) AddToObservedBranches

func (self *Config) AddToObservedBranches(branches ...gitdomain.LocalBranchName) error

AddToObservedBranches registers the given branch names as perennial branches. The branches must exist.

func (*Config) AddToParkedBranches

func (self *Config) AddToParkedBranches(branches ...gitdomain.LocalBranchName) error

AddToParkedBranches registers the given branch names as perennial branches. The branches must exist.

func (*Config) AddToPerennialBranches

func (self *Config) AddToPerennialBranches(branches ...gitdomain.LocalBranchName) error

AddToPerennialBranches registers the given branch names as perennial branches. The branches must exist.

func (*Config) Author added in v14.2.0

func (self *Config) Author() (gitdomain.Author, error)

Author provides the locally Git configured user.

func (*Config) OriginURL

func (self *Config) OriginURL() *giturl.Parts

OriginURL provides the URL for the "origin" remote. Tests can stub this through the GIT_TOWN_REMOTE environment variable. Caches its result so can be called repeatedly.

func (*Config) OriginURLString

func (self *Config) OriginURLString() string

OriginURLString provides the URL for the "origin" remote. Tests can stub this through the GIT_TOWN_REMOTE environment variable.

func (*Config) Reload

func (self *Config) Reload()

func (*Config) RemoveFromContributionBranches

func (self *Config) RemoveFromContributionBranches(branch gitdomain.LocalBranchName) error

RemoveFromContributionBranches removes the given branch as a perennial branch.

func (*Config) RemoveFromObservedBranches

func (self *Config) RemoveFromObservedBranches(branch gitdomain.LocalBranchName) error

RemoveFromObservedBranches removes the given branch as a perennial branch.

func (*Config) RemoveFromParkedBranches

func (self *Config) RemoveFromParkedBranches(branch gitdomain.LocalBranchName) error

RemoveFromParkedBranches removes the given branch as a perennial branch.

func (*Config) RemoveFromPerennialBranches

func (self *Config) RemoveFromPerennialBranches(branch gitdomain.LocalBranchName) error

RemoveFromPerennialBranches removes the given branch as a perennial branch.

func (*Config) RemoveMainBranch

func (self *Config) RemoveMainBranch()

func (*Config) RemoveOutdatedConfiguration added in v14.2.0

func (self *Config) RemoveOutdatedConfiguration(localBranches gitdomain.LocalBranchNames) error

RemoveOutdatedConfiguration removes outdated Git Town configuration.

func (*Config) RemoveParent

func (self *Config) RemoveParent(branch gitdomain.LocalBranchName)

RemoveParent removes the parent branch entry for the given branch from the Git configuration.

func (*Config) RemovePerennialBranches

func (self *Config) RemovePerennialBranches()

func (*Config) RemovePerennialRegex

func (self *Config) RemovePerennialRegex()

func (*Config) RemovePushHook

func (self *Config) RemovePushHook()

func (*Config) RemovePushNewBranches

func (self *Config) RemovePushNewBranches()

func (*Config) RemoveShipDeleteTrackingBranch

func (self *Config) RemoveShipDeleteTrackingBranch()

func (*Config) RemoveSyncBeforeShip

func (self *Config) RemoveSyncBeforeShip()

func (*Config) RemoveSyncFeatureStrategy

func (self *Config) RemoveSyncFeatureStrategy()

func (*Config) RemoveSyncPerennialStrategy

func (self *Config) RemoveSyncPerennialStrategy()

func (*Config) RemoveSyncUpstream

func (self *Config) RemoveSyncUpstream()

func (*Config) SetContributionBranches

func (self *Config) SetContributionBranches(branches gitdomain.LocalBranchNames) error

SetObservedBranches marks the given branches as observed branches.

func (*Config) SetMainBranch

func (self *Config) SetMainBranch(branch gitdomain.LocalBranchName) error

SetMainBranch marks the given branch as the main branch in the Git Town configuration.

func (*Config) SetObservedBranches

func (self *Config) SetObservedBranches(branches gitdomain.LocalBranchNames) error

SetContributionBranches marks the given branches as contribution branches.

func (*Config) SetOffline

func (self *Config) SetOffline(value configdomain.Offline) error

SetOffline updates whether Git Town is in offline mode.

func (*Config) SetOriginHostname

func (self *Config) SetOriginHostname(hostName configdomain.HostingOriginHostname) error

SetOriginHostname marks the given branch as the main branch in the Git Town configuration.

func (*Config) SetParent

func (self *Config) SetParent(branch, parentBranch gitdomain.LocalBranchName) error

SetParent marks the given branch as the direct parent of the other given branch in the Git Town configuration.

func (*Config) SetParkedBranches

func (self *Config) SetParkedBranches(branches gitdomain.LocalBranchNames) error

SetObservedBranches marks the given branches as perennial branches.

func (*Config) SetPerennialBranches

func (self *Config) SetPerennialBranches(branches gitdomain.LocalBranchNames) error

SetPerennialBranches marks the given branches as perennial branches.

func (*Config) SetPerennialRegexLocally

func (self *Config) SetPerennialRegexLocally(value configdomain.PerennialRegex) error

SetPushHookLocally updates the locally configured push-hook strategy.

func (*Config) SetPushHookGlobally

func (self *Config) SetPushHookGlobally(value configdomain.PushHook) error

SetPushHook updates the configured push-hook strategy.

func (*Config) SetPushHookLocally

func (self *Config) SetPushHookLocally(value configdomain.PushHook) error

SetPushHookLocally updates the locally configured push-hook strategy.

func (*Config) SetPushNewBranches

func (self *Config) SetPushNewBranches(value configdomain.PushNewBranches, global bool) error

SetPushNewBranches updates whether the current repository is configured to push freshly created branches to origin.

func (*Config) SetShipDeleteTrackingBranch

func (self *Config) SetShipDeleteTrackingBranch(value configdomain.ShipDeleteTrackingBranch, global bool) error

SetShipDeleteTrackingBranch updates the configured delete-tracking-branch strategy.

func (*Config) SetSyncBeforeShip

func (self *Config) SetSyncBeforeShip(value configdomain.SyncBeforeShip, global bool) error

func (*Config) SetSyncFeatureStrategy

func (self *Config) SetSyncFeatureStrategy(value configdomain.SyncFeatureStrategy) error

func (*Config) SetSyncFeatureStrategyGlobal

func (self *Config) SetSyncFeatureStrategyGlobal(value configdomain.SyncFeatureStrategy) error

func (*Config) SetSyncPerennialStrategy

func (self *Config) SetSyncPerennialStrategy(strategy configdomain.SyncPerennialStrategy) error

SetSyncPerennialStrategy updates the configured sync-perennial strategy.

func (*Config) SetSyncUpstream

func (self *Config) SetSyncUpstream(value configdomain.SyncUpstream, global bool) error

SetSyncUpstream updates the configured sync-upstream strategy.

type NewConfigArgs

type NewConfigArgs struct {
	ConfigFile   *configdomain.PartialConfig
	DryRun       bool
	GlobalConfig configdomain.PartialConfig
	LocalConfig  configdomain.PartialConfig
	Runner       gitconfig.Runner
}

Directories

Path Synopsis
Package commandconfig provides reusable infrastructure for the configuration of Git Town commands
Package commandconfig provides reusable infrastructure for the configuration of Git Town commands
Package configdomain defines domain concepts and data types around Git Town configuration.
Package configdomain defines domain concepts and data types around Git Town configuration.
Package configfile provides functionality around storing Git Town configuration information in a dedicated configuration file.
Package configfile provides functionality around storing Git Town configuration information in a dedicated configuration file.
Package envconfig provides functionality to read configuration overrides from environment variables.
Package envconfig provides functionality to read configuration overrides from environment variables.
Package gitconfig provides functionality around storing Git Town configuration information as Git metadata.
Package gitconfig provides functionality around storing Git Town configuration information as Git metadata.

Jump to

Keyboard shortcuts

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