core

package
v0.0.0-...-b722dbe Latest Latest
Warning

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

Go to latest
Published: Jul 27, 2024 License: GPL-3.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AppendToFiles

func AppendToFiles(filePath, commiter, email, msg, SHA1, time string) error

Append the content at the end of specified files used for appending logs at the end of log files present inside logs directory

func ChangeActiveBranch

func ChangeActiveBranch(pathToLit, branchname string) error

func Checkout

func Checkout(PathToLit, BranchName string)

Perform checkout operation to switch to other branch

func Commit

func Commit(commitMessage, pathToBitDirectory string) error

func CoreAdd

func CoreAdd(path string, untracked, modified, deleted []FileInfo)

takes current file information from status command and writes it to the index file resulting into moving those files into staging area takes root directory filepath and fileinfo

func CreateBranch

func CreateBranch(pathToLit, branchname string) error

Function to create new branch

func CurrentActiveBranch

func CurrentActiveBranch(pathToLit string) (string, error)

Function which returns the current active branch

func DecompressAndSaveFile

func DecompressAndSaveFile(inputFilePath, outputFilePath string) error

func DecompressFile

func DecompressFile(inputFilePath string) (string, error)

func GenerateIndex

func GenerateIndex(PathToLit, Tree_Object_Hash string) (map[string]FileInfo, error)

generate index file for the new branch

func GetIndexFileContent

func GetIndexFileContent(path string) map[string]FileInfo

func GetStatus

func GetStatus(files []FileInfo, path string) ([]FileInfo, []FileInfo, []FileInfo, []FileInfo, error)

Get the slice of tracked, modified, deleted and unracked files It takes the information about files in current director with index filepath

func Init

func Init(path string) bool

initializes the directory as bit directory

func ListBranches

func ListBranches(pathToLit string) error

List all the branches and show the current active branch

func LogsBranchChange

func LogsBranchChange(logFilePath, msg string) error

func RemoveFilesFromStagingArea

func RemoveFilesFromStagingArea(bitDirPath string, files []string)

func Restore

func Restore(paths []string, rootDirPath string, staged bool) error

Restores the current state of the file with previous state

func Switch

func Switch(dir string, currentB, newB map[string]FileInfo) error

Performs actual switching operation of branch command

Types

type FileInfo

type FileInfo struct {
	FileName       string
	FilePath       string
	FileSize       uint64
	FilePerm       uint32
	FileModifiedAt time.Time
	SHA1           string
	FileStatus     string
	CommitStatus   string
}

func GetFilesStatus

func GetFilesStatus(dir string) []FileInfo

type TreeInfo

type TreeInfo struct {
	Type        string
	Perm        int64
	SHA1        string
	FileName    string
	Modified_at string
	FilePath    string
	FileSize    int
}

func GetTree

func GetTree(indexFile *map[string]FileInfo, mainDir, dir string) (TreeInfo, error)

A recursive function which iterates over the directory structure recursively inorder to gather data to create tree object

Directories

Path Synopsis
Structs

Jump to

Keyboard shortcuts

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