Fix bug that caused unreleased presaving feature to accidentally save entries that were prefixed with a space

This commit is contained in:
David Dworken 2023-10-30 17:42:09 -07:00
parent be377dee82
commit 5f9ff9e158
No known key found for this signature in database

View File

@ -149,7 +149,7 @@ func presaveHistoryEntry(ctx context.Context) {
cmd, err := extractCommandFromArg(ctx, shellName, os.Args[3] /* isPresave = */, true) cmd, err := extractCommandFromArg(ctx, shellName, os.Args[3] /* isPresave = */, true)
lib.CheckFatalError(err) lib.CheckFatalError(err)
entry.Command = cmd entry.Command = cmd
if strings.HasPrefix(" ", entry.Command) || strings.TrimSpace(entry.Command) == "" { if strings.HasPrefix(entry.Command, " ") || strings.TrimSpace(entry.Command) == "" {
// Don't save commands that start with a space // Don't save commands that start with a space
return return
} }