switching everything over to []byte, abandoning merkletree for now
This commit is contained in:
@@ -1,40 +1,13 @@
|
||||
package clientcmd
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
|
||||
clientconfig "github.com/deranjer/gvc/client/clientconfig"
|
||||
"github.com/deranjer/gvc/common/database"
|
||||
"github.com/deranjer/gvc/common/engine"
|
||||
"github.com/deranjer/gvc/common/manager"
|
||||
)
|
||||
|
||||
// Commit commits the tracked files and changes to the repo
|
||||
func Commit(conf *clientconfig.Gvcconfig, commitMessage string, m *manager.Manager) error {
|
||||
trackedFiles, err := m.FetchTrackedFiles()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
var filesToDiff []database.File // Contains the list of files that have changed
|
||||
for _, trackedFile := range trackedFiles {
|
||||
currentFile, err := os.Stat(trackedFile.Path)
|
||||
if err != nil {
|
||||
fmt.Printf("unable to stat tracked file: %s error: %s\n", currentFile.Name(), err)
|
||||
continue
|
||||
}
|
||||
currentFileHash, err := engine.UniqueFileHash(trackedFile.Path)
|
||||
if err != nil {
|
||||
fmt.Printf("unable to create hash for file: %s error: %s\n", currentFile.Name(), err)
|
||||
continue
|
||||
}
|
||||
if currentFileHash == trackedFile.CurrentHash {
|
||||
fmt.Printf("No changes found in file: %s when compared to file: %s\n", currentFile.Name(), trackedFile.Name)
|
||||
continue
|
||||
}
|
||||
filesToDiff = append(filesToDiff, trackedFile)
|
||||
}
|
||||
m.BeginCommit(filesToDiff, conf.CurrentBranch)
|
||||
m.BeginCommit(conf.CurrentBranch)
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user