adding decompress
This commit is contained in:
@@ -88,7 +88,7 @@ func (db *DB) UpdateFileData(filePath, basePath string, hash []byte) error {
|
||||
db.Err(err).Msg("Error updating the file base")
|
||||
return err
|
||||
} else {
|
||||
err := db.Update(&File{ID: file.ID, CurrentBase: basePath, Hash: hash})
|
||||
err := db.Update(&File{ID: file.ID, BaseFilePath: basePath, Hash: hash})
|
||||
return err
|
||||
}
|
||||
}
|
||||
@@ -198,6 +198,18 @@ func (db *DB) FetchLastCommitOnBranch(branch string) (commitResult Commit, err e
|
||||
err = query.OrderBy("Number").Reverse().First(&commit) // Getting the last entry by number
|
||||
if err != nil {
|
||||
db.Err(err).Msgf("Failed to find last commit on branch: %s", branch)
|
||||
return commit, err
|
||||
}
|
||||
return commit, nil
|
||||
}
|
||||
|
||||
// NewCommit writes a new commit to the specified branch into the database
|
||||
func (db *DB) NewCommit(newCommit Commit, branch string) error {
|
||||
db.Info().Msgf("Writing new commit: %s on branch: %s", newCommit.Number, branch)
|
||||
err := db.Save(&newCommit)
|
||||
if err != nil {
|
||||
db.Err(err).Msg("failure to write commit to database")
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
Reference in New Issue
Block a user