starting work on new commit logic

This commit is contained in:
2020-08-31 22:45:27 -04:00
parent ebd6e095f7
commit cb24c6f2c8
5 changed files with 59 additions and 295 deletions

View File

@@ -220,8 +220,10 @@ func (m *Manager) BeginCommit(branch string, commitMessage string) error {
m.Err(err).Msgf("unable to create initial commit: %s", err)
return err
}
m.Info().Msgf("Initial Commit Created, returning...")
return nil
}
var filesToDiff []database.File // Contains the list of files that have changed
var filesToDiff []database.File // Contains the list of files that have changed since the initial commit
for _, trackedFile := range trackedFiles {
fmt.Println("Working on file: ", trackedFile.Path)
if trackedFile.Path == "" {
@@ -253,7 +255,12 @@ func (m *Manager) BeginCommit(branch string, commitMessage string) error {
m.Info().Msgf("No changed files found to commit on branch: %s", branch)
return fmt.Errorf("no changed files, cannot commit on branch: %s", branch)
}
fmt.Println("COMMIT: ", commit.CommitHash)
fmt.Println("COMMIT: ", hex.EncodeToString(commit.CommitHash))
newCommitNumber := commit.Number + 1
err = m.CreateCommit(filesToDiff, trackedFiles, branch, commitMessage, newCommitNumber)
if err != nil {
return err
}
return nil
}