gitconfig

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: 9 Imported by: 1

Documentation

Overview

Package gitconfig provides functionality around storing Git Town configuration information as Git metadata. Git Town stores configuration in two locations: 1. Git metadata of the local repository. You can see it with `git config -l --local` 2. Global Git metadata. You can seet it with `git config -l --global`

Index

Constants

View Source
const (
	KeyAliasAppend                         = Key("alias.append")
	KeyAliasCompress                       = Key("alias.compress")
	KeyAliasContribute                     = Key("alias.contribute")
	KeyAliasDiffParent                     = Key("alias.diff-parent")
	KeyAliasHack                           = Key("alias.hack")
	KeyAliasKill                           = Key("alias.kill")
	KeyAliasObserve                        = Key("alias.observe")
	KeyAliasPark                           = Key("alias.park")
	KeyAliasPrepend                        = Key("alias.prepend")
	KeyAliasPropose                        = Key("alias.propose")
	KeyAliasRenameBranch                   = Key("alias.rename-branch")
	KeyAliasRepo                           = Key("alias.repo")
	KeyAliasSetParent                      = Key("alias.set-parent")
	KeyAliasShip                           = Key("alias.ship")
	KeyAliasSync                           = Key("alias.sync")
	KeyContributionBranches                = Key("git-town.contribution-branches")
	KeyDeprecatedCodeHostingDriver         = Key("git-town.code-hosting-driver")
	KeyDeprecatedCodeHostingOriginHostname = Key("git-town.code-hosting-origin-hostname")
	KeyDeprecatedCodeHostingPlatform       = Key("git-town.code-hosting-platform")
	KeyDeprecatedMainBranchName            = Key("git-town.main-branch-name")
	KeyDeprecatedNewBranchPushFlag         = Key("git-town.new-branch-push-flag")
	KeyDeprecatedPerennialBranchNames      = Key("git-town.perennial-branch-names")
	KeyDeprecatedPullBranchStrategy        = Key("git-town.pull-branch-strategy")
	KeyDeprecatedPushVerify                = Key("git-town.push-verify")
	KeyDeprecatedShipDeleteRemoteBranch    = Key("git-town.ship-delete-remote-branch")
	KeyDeprecatedSyncStrategy              = Key("git-town.sync-strategy")
	KeyGiteaToken                          = Key("git-town.gitea-token")
	KeyGithubToken                         = Key("git-town.github-token")
	KeyGitlabToken                         = Key("git-town.gitlab-token")
	KeyHostingOriginHostname               = Key("git-town.hosting-origin-hostname")
	KeyHostingPlatform                     = Key("git-town.hosting-platform")
	KeyMainBranch                          = Key("git-town.main-branch")
	KeyObservedBranches                    = Key("git-town.observed-branches")
	KeyOffline                             = Key("git-town.offline")
	KeyParkedBranches                      = Key("git-town.parked-branches")
	KeyPerennialBranches                   = Key("git-town.perennial-branches")
	KeyPerennialRegex                      = Key("git-town.perennial-regex")
	KeyPushHook                            = Key("git-town.push-hook")
	KeyPushNewBranches                     = Key("git-town.push-new-branches")
	KeyShipDeleteTrackingBranch            = Key("git-town.ship-delete-tracking-branch")
	KeySyncBeforeShip                      = Key("git-town.sync-before-ship")
	KeySyncFeatureStrategy                 = Key("git-town.sync-feature-strategy")
	KeySyncPerennialStrategy               = Key("git-town.sync-perennial-strategy")
	KeySyncStrategy                        = Key("git-town.sync-strategy")
	KeySyncUpstream                        = Key("git-town.sync-upstream")
	KeyGitUserEmail                        = Key("user.email")
	KeyGitUserName                         = Key("user.name")
)
View Source
const (
	LineageKeyPrefix = "git-town-branch."
	LineageKeySuffix = ".parent"
)

Variables

DeprecatedKeys defines the up-to-date counterparts to deprecated configuration settings.

Functions

func AddKeyToPartialConfig

func AddKeyToPartialConfig(key Key, value string, config *configdomain.PartialConfig) error

func AliasableCommandForKey

func AliasableCommandForKey(key Key) *configdomain.AliasableCommand

Types

type Access

type Access struct {
	Runner
}

Access provides typesafe access to the Git configuration on disk.

func (*Access) LoadGlobal

func (self *Access) LoadGlobal(updateOutdated bool) (SingleSnapshot, configdomain.PartialConfig, error)

LoadLocal reads the global Git Town configuration that applies to the entire machine.

func (*Access) LoadLocal

func (self *Access) LoadLocal(updateOutdated bool) (SingleSnapshot, configdomain.PartialConfig, error)

LoadLocal reads the Git Town configuration from the local Git's metadata for the current repository.

func (*Access) OriginRemote

func (self *Access) OriginRemote() string

func (*Access) RemoveGlobalConfigValue

func (self *Access) RemoveGlobalConfigValue(key Key) error

func (*Access) RemoveLocalConfigValue

func (self *Access) RemoveLocalConfigValue(key Key) error

removeLocalConfigurationValue deletes the configuration value with the given key from the local Git Town configuration.

func (*Access) RemoveLocalGitConfiguration

func (self *Access) RemoveLocalGitConfiguration(lineage configdomain.Lineage) error

RemoveLocalGitConfiguration removes all Git Town configuration.

func (*Access) SetGlobalConfigValue

func (self *Access) SetGlobalConfigValue(key Key, value string) error

SetGlobalConfigValue sets the given configuration setting in the global Git configuration.

func (*Access) SetLocalConfigValue

func (self *Access) SetLocalConfigValue(key Key, value string) error

SetLocalConfigValue sets the local configuration with the given key to the given value.

func (*Access) UpdateDeprecatedGlobalSetting

func (self *Access) UpdateDeprecatedGlobalSetting(oldKey, newKey Key, value string)

func (*Access) UpdateDeprecatedLocalSetting

func (self *Access) UpdateDeprecatedLocalSetting(oldKey, newKey Key, value string)

func (*Access) UpdateDeprecatedSetting

func (self *Access) UpdateDeprecatedSetting(oldKey, newKey Key, value string, global bool)

type Key

type Key string

Key contains all the keys used in Git Town's Git metadata configuration.

func KeyForAliasableCommand

func KeyForAliasableCommand(aliasableCommand configdomain.AliasableCommand) Key

func NewParentKey

func NewParentKey(branch gitdomain.LocalBranchName) Key

func ParseKey

func ParseKey(name string) *Key

func (Key) MarshalJSON

func (self Key) MarshalJSON() ([]byte, error)

MarshalJSON is used when serializing this LocalBranchName to JSON.

func (Key) String

func (self Key) String() string

func (*Key) UnmarshalJSON

func (self *Key) UnmarshalJSON(b []byte) error

UnmarshalJSON is used when de-serializing JSON into a Location.

type Runner

type Runner interface {
	Query(executable string, args ...string) (string, error)
	Run(executable string, args ...string) error
}

type SingleSnapshot

type SingleSnapshot map[Key]string

SingleSnapshot contains all of the local or global Git metadata config settings.

Jump to

Keyboard shortcuts

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