diff --git a/client/client_test.go b/client/client_test.go index b8bea7a..ea51b40 100644 --- a/client/client_test.go +++ b/client/client_test.go @@ -236,8 +236,13 @@ func testIntegrationWithNewDevice(t *testing.T, tester shellTester) { t.Fatalf("Failed to re-init with the user secret: %v", out) } - // Querying should show the history from the previous run + // Querying shouldn't show the entry from the previous account out = hishtoryQuery(t, tester, "") + if strings.Contains(out, "notinthehistory") { + t.Fatalf("output contains the unexpected item: notinthehistory: \n%s", out) + } + + // And it should show the history from the previous run on this account expected = []string{"echo thisisrecorded", "echo mynewcommand", "hishtory enable", "echo bar", "echo foo", "ls /foo", "ls /bar", "ls /a"} for _, item := range expected { if !strings.Contains(out, item) { @@ -247,10 +252,6 @@ func testIntegrationWithNewDevice(t *testing.T, tester shellTester) { t.Fatalf("output has %#v in it multiple times! out=%#v", item, out) } } - // But not from the previous account - if strings.Contains(out, "notinthehistory") { - t.Fatalf("output contains the unexpected item: notinthehistory") - } tester.RunInteractiveShell(t, "echo mynewercommand") out = hishtoryQuery(t, tester, "") diff --git a/hishtory.go b/hishtory.go index f992bc6..8631fe0 100644 --- a/hishtory.go +++ b/hishtory.go @@ -69,7 +69,7 @@ func main() { } } lib.CheckFatalError(lib.Setup(os.Args)) - if os.Getenv("HISHTORY_SKIP_INIT_IMPORT") != "" { + if os.Getenv("HISHTORY_SKIP_INIT_IMPORT") == "" { fmt.Println("Importing existing shell history...") ctx := hctx.MakeContext() numImported, err := lib.ImportHistory(ctx, false)