diff options
author | Michael Muré <batolettre@gmail.com> | 2021-01-24 19:45:21 +0100 |
---|---|---|
committer | Michael Muré <batolettre@gmail.com> | 2021-02-14 12:19:00 +0100 |
commit | dc5059bc3372941e2908739831188768335ac50b (patch) | |
tree | 7294aed90cf5f04809d7a99b4967b513bdb409d5 /entity/dag/entity.go | |
parent | 8d63c983c982f93cc48d3996d6bd097ddeeb327f (diff) | |
download | git-bug-dc5059bc3372941e2908739831188768335ac50b.tar.gz |
entity: more progress on merging and signing
Diffstat (limited to 'entity/dag/entity.go')
-rw-r--r-- | entity/dag/entity.go | 14 |
1 files changed, 4 insertions, 10 deletions
diff --git a/entity/dag/entity.go b/entity/dag/entity.go index 78347fa0..63d7fc3b 100644 --- a/entity/dag/entity.go +++ b/entity/dag/entity.go @@ -318,7 +318,6 @@ func (e *Entity) CommitAdNeeded(repo repository.ClockedRepo) error { } // Commit write the appended operations in the repository -// TODO: support commit signature func (e *Entity) Commit(repo repository.ClockedRepo) error { if !e.NeedCommit() { return fmt.Errorf("can't commit an entity with no pending operation") @@ -361,18 +360,13 @@ func (e *Entity) Commit(repo repository.ClockedRepo) error { // PackTime: packTime, } - treeHash, err := opp.Write(e.Definition, repo) - if err != nil { - return err - } - - // Write a Git commit referencing the tree, with the previous commit as parent var commitHash repository.Hash - if e.lastCommit != "" { - commitHash, err = repo.StoreCommit(treeHash, e.lastCommit) + if e.lastCommit == "" { + commitHash, err = opp.Write(e.Definition, repo) } else { - commitHash, err = repo.StoreCommit(treeHash) + commitHash, err = opp.Write(e.Definition, repo, e.lastCommit) } + if err != nil { return err } |