diff options
author | Michael Muré <batolettre@gmail.com> | 2019-11-19 18:54:22 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-11-19 18:54:22 +0100 |
commit | abae3c245e1f844ebadb79eb5d7b19412f67f886 (patch) | |
tree | 9c5e06aa4e1ef9b41ceb21408de493d2e91b3d00 /bug/bug.go | |
parent | fdbff4dba7d6e56edfed1030e6fede2a7a35b507 (diff) | |
parent | ed2ac793e9f353720db2615b06569d05c253b977 (diff) | |
download | git-bug-abae3c245e1f844ebadb79eb5d7b19412f67f886.tar.gz |
Merge pull request #257 from MichaelMure/core-fixes
Core fixes
Diffstat (limited to 'bug/bug.go')
-rw-r--r-- | bug/bug.go | 15 |
1 files changed, 6 insertions, 9 deletions
@@ -160,7 +160,7 @@ func readBug(repo repository.ClockedRepo, ref string) (*Bug, error) { rootFound = true } if strings.HasPrefix(entry.Name, createClockEntryPrefix) { - n, err := fmt.Sscanf(string(entry.Name), createClockEntryPattern, &createTime) + n, err := fmt.Sscanf(entry.Name, createClockEntryPattern, &createTime) if err != nil { return nil, errors.Wrap(err, "can't read create lamport time") } @@ -169,7 +169,7 @@ func readBug(repo repository.ClockedRepo, ref string) (*Bug, error) { } } if strings.HasPrefix(entry.Name, editClockEntryPrefix) { - n, err := fmt.Sscanf(string(entry.Name), editClockEntryPattern, &editTime) + n, err := fmt.Sscanf(entry.Name, editClockEntryPattern, &editTime) if err != nil { return nil, errors.Wrap(err, "can't read edit lamport time") } @@ -197,10 +197,10 @@ func readBug(repo repository.ClockedRepo, ref string) (*Bug, error) { } // Update the clocks - if err := repo.CreateWitness(bug.createTime); err != nil { + if err := repo.WitnessCreate(bug.createTime); err != nil { return nil, errors.Wrap(err, "failed to update create lamport clock") } - if err := repo.EditWitness(bug.editTime); err != nil { + if err := repo.WitnessEdit(bug.editTime); err != nil { return nil, errors.Wrap(err, "failed to update edit lamport clock") } @@ -350,11 +350,6 @@ func (bug *Bug) Append(op Operation) { bug.staging.Append(op) } -// HasPendingOp tell if the bug need to be committed -func (bug *Bug) HasPendingOp() bool { - return !bug.staging.IsEmpty() -} - // Commit write the staging area in Git and move the operations to the packs func (bug *Bug) Commit(repo repository.ClockedRepo) error { @@ -592,6 +587,8 @@ func (bug *Bug) Merge(repo repository.Repo, other Interface) (bool, error) { bug.lastCommit = hash } + bug.packs = newPacks + // Update the git ref err = repo.UpdateRef(bugsRefPattern+bug.id.String(), bug.lastCommit) if err != nil { |