Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stop irb:rdbg from saving duplicated history when there's no prior history file #853

Merged
merged 1 commit into from
Feb 1, 2024

Commits on Feb 1, 2024

  1. Reset history counter even when @loaded_history_lines is not defined

    The issue (https://github.com/ruby/debug/issues/1064) is caused by a
    combination of factors:
    
    1. When user starts an IRB session without a history file, the
       `@loaded_history_lines` ivar is not defined.
    2. If the user then starts the `irb:rdbg` session, the history counter
       is not set, because the `@loaded_history_lines` is not defined.
    3. Because `irb:rdbg` saves the history before passing Ruby expression
       to the debugger, it saves the history with duplicated lines. The number
       grows in exponential order.
    4. When the user exits the `irb:rdbg` session, the history file could be
       bloated with duplicated lines.
    
    This commit fixes the issue by resetting the history counter even when
    `@loaded_history_lines` is not defined.
    st0012 committed Feb 1, 2024
    Configuration menu
    Copy the full SHA
    763c0b7 View commit details
    Browse the repository at this point in the history