Skip to content
Permalink
Browse files Browse the repository at this point in the history
Ensure that git_path is a valid file (#11138)
* Ensure that git_path is a valid file

* Update github_updater.py
  • Loading branch information
medariox committed Feb 22, 2023
1 parent d44ae91 commit 66d4be8
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions medusa/updater/github_updater.py
Expand Up @@ -3,6 +3,7 @@
from __future__ import unicode_literals

import logging
import os
import platform
import re
import subprocess
Expand Down Expand Up @@ -72,11 +73,7 @@ def commits_ahead(self):

def _find_working_git(self):
test_cmd = 'version'

if app.GIT_PATH:
main_git = '"' + app.GIT_PATH + '"'
else:
main_git = 'git'
main_git = app.GIT_PATH or 'git'

log.debug(u'Checking if we can use git commands: {0} {1}', main_git, test_cmd)
_, _, exit_status = self._run_git(main_git, test_cmd)
Expand Down Expand Up @@ -126,6 +123,11 @@ def _run_git(self, git_path, args):
exit_status = 1
return output, err, exit_status

if git_path != 'git' and not os.path.isfile(git_path):
log.warning(u"Invalid git specified, can't use git commands")
exit_status = 1
return output, err, exit_status

# If we have a valid git remove the git warning
# String will be updated as soon we check github
app.NEWEST_VERSION_STRING = None
Expand Down

1 comment on commit 66d4be8

@heloid
Copy link

@heloid heloid commented on 66d4be8 Mar 19, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This broke handling of Windows paths with spaces, FYI

Please sign in to comment.