32 lines
1.0 KiB
Go
32 lines
1.0 KiB
Go
package engine
|
|
|
|
import (
|
|
"time"
|
|
|
|
"github.com/deranjer/gvc/common/database"
|
|
)
|
|
|
|
// CreateInitialCommit copies the files over and compresses them if they are not in the NoCompress struct
|
|
func (m *Manager) CreateInitialCommit(fileList []database.File, commitMessage string) error { // ONLY HAPPENS FOR MASTER I THINK, SO NO BRANCH NEEDED
|
|
//Need to deduplicate so we aren't storing duplicates of files, storing all the files in one folder won't work, will need something like git
|
|
//For initial commit no changes are made to files, so don't store anything, just save the list so you can send to server
|
|
var initialCommit database.Commit
|
|
initialCommit.Branch = "master"
|
|
hashBytes, err := CreateCommitHash(fileList, commitMessage)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
currentTime := time.Now()
|
|
initialCommit.CommitHash = hashBytes
|
|
initialCommit.Number = 1
|
|
initialCommit.TrackedFiles = fileList
|
|
initialCommit.Date = currentTime.String()
|
|
|
|
for _, file := range fileList {
|
|
go ConvertFileForStorage(&file, folder)
|
|
}
|
|
//var hashList [][]byte
|
|
return nil
|
|
|
|
}
|