Skip to content

Instantly share code, notes, and snippets.

@MihailJP
Created June 8, 2024 14:40
Show Gist options
  • Save MihailJP/cbecb20674fdce05da8a953b7d1adcd8 to your computer and use it in GitHub Desktop.
Save MihailJP/cbecb20674fdce05da8a953b7d1adcd8 to your computer and use it in GitHub Desktop.
PyGitUp workaround for MSYS2/MinGW (for git-up 2.2.0)
--- gitup.py.orig 2023-08-19 22:19:24.904702800 +0900
+++ gitup.py 2024-06-08 23:33:47.171299400 +0900
@@ -33,6 +33,7 @@
import colorama
from git import Repo, GitCmdObjectDB
from termcolor import colored
+from git.exc import NoSuchPathError
# PyGitUp libs
from PyGitUp.utils import execute, uniq, find
@@ -129,7 +130,11 @@
exc = GitError("We don't seem to be in a git repository.")
raise exc
- self.repo = Repo(repo_dir, odbt=GitCmdObjectDB)
+ try:
+ self.repo = Repo(repo_dir, odbt=GitCmdObjectDB)
+ except NoSuchPathError:
+ repo_dir = re.sub(r'^/([a-z])/', r'\1:/', repo_dir, flags=re.IGNORECASE)
+ self.repo = Repo(repo_dir, odbt=GitCmdObjectDB)
# Check for branch tracking information
if not any(b.tracking_branch() for b in self.repo.branches):
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment