git

package
v0.13.0 Latest Latest
Warning

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

Go to latest
Published: Apr 24, 2024 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Overview

SPDX-License-Identifier: Apache-2.0

Copyright © 2023 The listen.dev team <engineering@garnet.ai>

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

SPDX-License-Identifier: Apache-2.0

Copyright © 2023 The listen.dev team <engineering@garnet.ai>

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

SPDX-License-Identifier: Apache-2.0

Copyright © 2023 The listen.dev team <engineering@garnet.ai>

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetConfig

func GetConfig(s config.Scope) (*config.Config, error)

GetConfig returns an instance of config.Config for the required scope (system or global Git configuration).

func GetFinalConfig

func GetFinalConfig(repo *git.Repository) (*config.Config, error)

GetFinalConfig retrives system, global, and local Git configurations and then merges them into a final config.Config instance.

This function also applies Git URL rules (if any) to the Git remotes.

func NewConfigFromMap

func NewConfigFromMap(src map[string]string) *config.Config

NewConfigFromMap provides a config.Config instance populating it from the input map.

func ReadConfig

func ReadConfig(r io.Reader) (*config.Config, error)

ReadConfig parses a Git configuration file in an io.Reader.

Types

type Author

type Author struct {
	Name  string `json:"email,omitempty"`
	Email string `json:"name,omitempty"`
}

type Context

type Context struct {
	User    `json:"user,omitempty"`
	Author  `json:"author,omitempty"`
	Remotes map[string]*Remote `json:"remotes,omitempty"`
}

func NewContextFromFunc

func NewContextFromFunc(f GetDirFunc) (*Context, error)

func NewContextFromPath

func NewContextFromPath(path string) (*Context, error)

func (Context) MarshalJSON

func (c Context) MarshalJSON() ([]byte, error)

type FetchURL

type FetchURL struct {
	URL string `json:"url"`
}

type GetDirFunc

type GetDirFunc func() (string, error)

type PushURL

type PushURL struct {
	URL string `json:"url"`
}

type Remote

type Remote struct {
	FetchURL `json:"fetch"`
	PushURL  `json:"push"`
}

type User

type User struct {
	Name  string `json:"name,omitempty"`
	Email string `json:"email,omitempty"`
}

Jump to

Keyboard shortcuts

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