utils

package
v0.0.0-...-7eb13b2 Latest Latest
Warning

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

Go to latest
Published: Sep 26, 2024 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Copyright © 2024 Kei-K23 <[email protected]>

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CompressContent

func CompressContent(compressBuf *bytes.Buffer, fileContentBytes []byte) error

Utility function for file content compression

func DecompressContent

func DecompressContent(compressedBuf *bytes.Buffer) ([]byte, error)

Utility function for file content decompression

func GerCurrentBranch

func GerCurrentBranch() string

Get current active branch (e.g main or dev, etc...)

func GetCurrentCommit

func GetCurrentCommit() string

Get current commit hash

func GetCurrentTime

func GetCurrentTime() string

Get the current time in RFC3339 format

func GetHashValueOfStagedFile

func GetHashValueOfStagedFile(filename string) string

Get hash value of staging file with their file name

func HandFileContent

func HandFileContent(fileContentBytes []byte) (string, error)

func IsFileModified

func IsFileModified(filename string) bool

Check file is made changes and modified to use in (e.g before adding file to staging area make sure file is modified or not)

func ReadCommitObject

func ReadCommitObject(hashValue string) []byte

Read commit object

func UpdateCommitHashValue

func UpdateCommitHashValue(newHash string)

Function to update the latest commit hash value in the branch reference file

func WriteIndexFile

func WriteIndexFile(entries []IndexEntry) error

Types

type IndexEntry

type IndexEntry struct {
	Mode string
	Hash string
	Path string
}

func ReadIndexFile

func ReadIndexFile() ([]IndexEntry, error)

func UpdateIndexFileHashValue

func UpdateIndexFileHashValue(entries []IndexEntry, filepath string, newHash string) []IndexEntry

Jump to

Keyboard shortcuts

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