# Buggy code
def run(self):
    active_view_id = self.window.active_view().id()
    if active_view_id not in views_with_offer_made and sublime.ok_cancel_dialog(
        NO_REPO_MESSAGE
    ):
        self.window.run_command("gs_init")
    else:
        views_with_offer_made.add(active_view_id)


# Traceback (GitSavvy.core.git_command.GitSavvyError)
Traceback (most recent call last):
File "core.git_command in C:\Users\fpeij\AppData\Roaming\Sublime Text 3\Installed Packages\GitSavvy.sublime-package", line 133, in git
File "core.git_command in C:\Users\fpeij\AppData\Roaming\Sublime Text 3\Installed Packages\GitSavvy.sublime-package", line 215, in repo_path
File "core.git_command in C:\Users\fpeij\AppData\Roaming\Sublime Text 3\Installed Packages\GitSavvy.sublime-package", line 255, in _repo_path
File "core.git_command in C:\Users\fpeij\AppData\Roaming\Sublime Text 3\Installed Packages\GitSavvy.sublime-package", line 156, in git
File "core.git_command in C:\Users\fpeij\AppData\Roaming\Sublime Text 3\Installed Packages\GitSavvy.sublime-package", line 119, in raise_error
GitSavvy.core.git_command.GitSavvyError: `C:\Program Files\Git\cmd\git.EXE rev-parse --show-toplevel` failed with following output:

fatal: Not a git repository (or any of the parent directories): .git


During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "common.ui in C:\Users\fpeij\AppData\Roaming\Sublime Text 3\Installed Packages\GitSavvy.sublime-package", line 289, in run_async
File "common.ui in C:\Users\fpeij\AppData\Roaming\Sublime Text 3\Installed Packages\GitSavvy.sublime-package", line 65, in __init__
File "common.ui in C:\Users\fpeij\AppData\Roaming\Sublime Text 3\Installed Packages\GitSavvy.sublime-package", line 101, in render
File "common.ui in C:\Users\fpeij\AppData\Roaming\Sublime Text 3\Installed Packages\GitSavvy.sublime-package", line 117, in _render_template
File "common.ui in C:\Users\fpeij\AppData\Roaming\Sublime Text 3\Installed Packages\GitSavvy.sublime-package", line 155, in get_keyed_content
File "./python3.3/collections/__init__.py", line 56, in __init__
SublimeLinter: glualint: sv_purchasing.lua ['C:\\Users\\fpeij\\Programs\\glualint\\dist\\build\\glualint\\glualint.exe']   File "./python3.3/collections/abc.py", line 578, in update

File "common.ui in C:\Users\fpeij\AppData\Roaming\Sublime Text 3\Installed Packages\GitSavvy.sublime-package", line 155, in <genexpr>
File "core.interfaces.status in C:\Users\fpeij\AppData\Roaming\Sublime Text 3\Installed Packages\GitSavvy.sublime-package", line 189, in render_stashes
File "core.git_mixins.stash in C:\Users\fpeij\AppData\Roaming\Sublime Text 3\Installed Packages\GitSavvy.sublime-package", line 13, in get_stashes
File "core.git_command in C:\Users\fpeij\AppData\Roaming\Sublime Text 3\Installed Packages\GitSavvy.sublime-package", line 141, in git
File "core.git_command in C:\Users\fpeij\AppData\Roaming\Sublime Text 3\Installed Packages\GitSavvy.sublime-package", line 119, in raise_error
GitSavvy.core.git_command.GitSavvyError: `C:\Program Files\Git\cmd\git.EXE rev-parse --show-toplevel` failed with following output:

fatal: Not a git repository (or any of the parent directories): .git

# Fixed code
def run(self):
    savvy_settings = sublime.load_settings("GitSavvy.sublime-settings")
    if savvy_settings.get("disable_git_init_prompt"):
        return

    active_view_id = self.window.active_view().id()
    if active_view_id not in views_with_offer_made and sublime.ok_cancel_dialog(
        NO_REPO_MESSAGE
    ):
        self.window.run_command("gs_init")
    else:
        views_with_offer_made.add(active_view_id)