Try harder to get the git root directory the first time GitGotoDiff is called#524
Conversation
… git root directory first time GitGotoDiff is called.
|
Thank you for your work. But the #496 can not be solved by this change. I pull your commit and test failed. As my said at #496, active view is changed and the new view window can not get the file path. That means it is too late to get the git root path. At the moment, self.active_file_path() and window.folders()[0] are both None. It is no way to get git root path back again. The solution is to get the git root path before creating new scratch view, and then store the git root path into new view. |
|
@kemayo This fixes an annoyance in that we currently ask the user for the git root every single time. I've been using this in my own work for the last week and it's made a huge difference in the quality of this plugin for me. Should I file an issue for this to help get it merged in? Or is there anything I can do better to get it merged in? Thanks!! =:) |
|
Meh, sorry to bug you again, but I just hit this on my second machine where I'm not running with my patch here and this is really annoying. This patch makes the experience so much better. Any thoughts, @kemayo? |
|
Thank youuuuu!! <3 |
The problem is that we always prompt the user for the root git directory. GitWindowCommand has a nice little addition to its get_working_dir() method to try to get an open folder from the window as a last ditch effort. This change refactors the code from GitWindowCommand.get_working_dir() out into a reusable method named get_open_folder_from_window(). GitGotoDiff can now use the new get_open_folder_from_window() method to try to get a git root directory if one hasn't been set yet.