utils

package
v0.40.4 Latest Latest
Warning

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

Go to latest
Published: May 19, 2022 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Package utils contains utility functions for use throughout git-dolt.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AppendToFile

func AppendToFile(f string, s string) error

AppendToFile appends the given string to the given file in the current directory, creating it if it does not exist.

func CurrentRevision

func CurrentRevision(dirname string) (string, error)

CurrentRevision gets the commit hash of the currently checked-out revision of the dolt repo at the given dirname.

func EnsureSuffix

func EnsureSuffix(s string, suffix string) string

EnsureSuffix adds a suffix to a string if not already present.

func FindGitConfigDir

func FindGitConfigDir(currentPath, terminalPath string) (string, error)

FindGitConfigDir will recurse upwards from currentPath to terminalPath looking for a directory named .git, returning its path if found, and an error if not.

Both currentPath and terminalPath are assumed to be absolute paths. An error is returned if currentPath is not a descendant of terminalPath.

func FindGitConfigUnderRoot

func FindGitConfigUnderRoot() (string, error)

FindGitConfigUnderRoot will recurse upwards from the current working directory to the system root looking for a directory named .git, returning its path if found, and an error if not.

func LastSegment

func LastSegment(s string) string

LastSegment gets the last segment of a slash-separated string.

Types

This section is empty.

Jump to

Keyboard shortcuts

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