ruby / irb

interactive Ruby
BSD 2-Clause "Simplified" License
393 stars 119 forks source link

The _history file should not appear in the project directory #896

Closed hahmed closed 8 months ago

hahmed commented 9 months ago

Issue https://github.com/ruby/irb/issues/674 (second part of that issue)

The _history file should not appear in the project directory, it should always appear in the IRBRC or HOME or XDG_CONFIG_HOME dir.

By keeping a reference to the extension and using that for the generators, the history file will appear in the HOME, IRBRC, XDG_CONFIG_HOME. If neither of those ENV vars are set, then the history file will appear in the same dir as the irbrc file. Might need to think about that last use case, not sure what we want to do there.

To repro the issue: first create the proj irbrc file, then create the history file, because the existing_rc_file_generators will have a value and point to the current proj irbrc file, when you create the history file later, it will create it in the same folder.

cc/ @st0012

tompng commented 8 months ago

Thanks for the pull request. I'm closing this because it's fixed in #901 with another approach. Split irbrc and irb_history searching logic was necessary to reduce complexity and to fix the problem correctly.