starting to write the commit functions

This commit is contained in:
2020-06-20 18:48:58 -04:00
parent 47cc65a824
commit 1ec7b436da
9 changed files with 268 additions and 32 deletions

View File

@@ -105,7 +105,6 @@ func (m *Manager) AddFileToRepo(relFilePath string) error {
// f := NewFileManager()
//DELAYED: this feature affects only large files and user experience. It can wait.
relFilePath = strings.TrimSpace(relFilePath) //purging any odd spaces TODO: Make sure not needed
fmt.Println("Checking for file: ", relFilePath)
var tmpFile database.File
filename := filepath.Base(relFilePath)
var hash [16]byte
@@ -160,3 +159,12 @@ func (m *Manager) prepareDatabaseForFile(tmpFile database.File) (int, error) {
return fileID, nil
}
// FetchTrackedFiles just grabbes all the files currently tracked in the repo
func (m *Manager) FetchTrackedFiles() ([]database.File, error) {
files, err := m.dB.RetrieveTrackedFiles()
if err != nil {
return nil, fmt.Errorf("unable to retrieve tracked files: %s", err)
}
return files, nil
}