Skip to content

Commit

Permalink
fix(logbook): commit timestamps overwrite run timestamps in logs
Browse files Browse the repository at this point in the history
  • Loading branch information
b5 committed Feb 17, 2021
1 parent 42310c3 commit 2ab44d0
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
4 changes: 2 additions & 2 deletions cmd/cmd_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -482,8 +482,8 @@ func TestSaveTransformModifiedButSameBody(t *testing.T) {
created dataset from tf_123.star
`, map[string]string{
"commit1": "/ipfs/Qmb18FaCYQMRbE4vH7G1sMnBr32opTBfKKeE6s7AYyR9YY",
"commit2": "/ipfs/QmSPaMdKzpEmodF7R6LzkTGHKtk4hvN6e6PsNKX1A6yW3g",
"commit1": "/ipfs/QmYSxB13nw1PWk6Y2itXxRiE42cvK5zzC9v6saGcDu8PFw",
"commit2": "/ipfs/QmZx6mYranv8ZFgwq7QVFoVVje2vPueC3MJYPy1LVnANmJ",
})
if diff := cmp.Diff(expect, output); diff != "" {
t.Errorf("log (-want +got):\n%s", diff)
Expand Down
6 changes: 3 additions & 3 deletions cmd/test_runner_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ import (
"github.com/qri-io/qri/repo/gen"
reporef "github.com/qri-io/qri/repo/ref"
repotest "github.com/qri-io/qri/repo/test"
"github.com/qri-io/qri/transform/run"
tfrun "github.com/qri-io/qri/transform/run"
"github.com/qri-io/qri/transform/startf"
"github.com/spf13/cobra"
)
Expand Down Expand Up @@ -131,7 +131,7 @@ func NewTestRunnerWithTempRegistry(t *testing.T, peerName, testName string) *Tes

func useConsistentRunIDs() {
source := strings.NewReader(strings.Repeat("OmgZombies!?!?!", 200))
run.SetIDRand(source)
tfrun.SetIDRand(source)
}

func newTestRunnerFromRoot(root *repotest.TempRepo) *TestRunner {
Expand Down Expand Up @@ -192,7 +192,7 @@ func (run *TestRunner) Delete() {
os.RemoveAll(run.TmpDir)
}
// restore random RunID generator
run.SetIDRand(nil)
tfrun.SetIDRand(nil)
dsfs.Timestamp = run.DsfsTsFunc
logbook.NewTimestamp = run.LogbookTsFunc
StringerLocation = run.LocOrig
Expand Down
1 change: 1 addition & 0 deletions logbook/logbook.go
Original file line number Diff line number Diff line change
Expand Up @@ -1132,6 +1132,7 @@ func runItemFromOp(ref dsref.Ref, op oplog.Op) dsref.VersionInfo {
}

func addCommitDetailsToRunItem(li dsref.VersionInfo, op oplog.Op) dsref.VersionInfo {
li.CommitTime = time.Unix(0, op.Timestamp)
li.CommitTitle = op.Note
li.BodySize = int(op.Size)
li.Path = op.Ref
Expand Down

0 comments on commit 2ab44d0

Please sign in to comment.